尝试绘制此图:
County Water_Pore SD_Pore
1 Custer 43.64000 9.559752
2 Franklin 43.62636 10.723884
3 Keith 54.27875 4.993334
4 Knox NaN NA
5 Lincoln 32.17000 12.313772
6 Nemaha 56.96900 6.360114
7 Otoe 60.61143 6.131110
8 Seward 53.39813 10.578624
9 Sherman 31.32875 5.338045
10 Stanton 48.17917 NA
p <- ggplot(result, aes(x=County, y=Water_Pore)) +
geom_point(color="blue",size = 5 +
geom_errorbar(aes(ymin=Water_Pore-sd,
ymax=Water_Pore+sd))
print(p)
错误:出现意外符号: “ geom_errorbar(aes(ymin = Water_Pore-sd,ymax = Water_Pore + sd))
我得到的积分没有错误栏。我想要误差线和要点。 TIA!
答案 0 :(得分:1)
似乎没有右括号...请尝试以下操作:
p<- ggplot(result, aes(x=County, y=Water_Pore)) +
geom_point(color="blue",size = 5) +
geom_errorbar(aes(ymin=Water_Pore-sd, ymax=Water_Pore+sd))
print(p)
答案 1 :(得分:1)
看起来geom_errorbar
在引用sd
,但在数据中称为SD_Pore
。可能是:
p <- ggplot(result, aes(x = County, y = Water_Pore)) +
geom_point(color="blue", size = 5) +
geom_errorbar(aes(ymin = Water_Pore - SD_Pore,
ymax = Water_Pore + SD_Pore))