在ggplot2中添加geom_errorbar时出错

时间:2017-09-04 21:01:54

标签: r ggplot2 errorbar

我正在尝试在我的散点图中添加一些错误栏,但我无法解决错误。代码如下:

growth_means <- read.csv("growth_means.csv")

plot = ggplot() + 
  geom_point(aes(x=HAS, y=Width, colour=Genotype), 
             size=1.5, data=growth_means, stat="identity") + 
  geom_errorbar(inherit.aes = FALSE, 
                ymin=Width-Width_SE, ymax=Width-Width_SE)

plot

以下数据:

> head(growth_means)


HAS DAS      Width    Width_SE    Length   Length_SE       Area     Area_SE Genotype
1 120   5 0.07021040 0.002033000 0.1064330 0.006007115 0.00593173 0.000428288       WT
2 120   5 0.09270133 0.006270253 0.1324452 0.009192732 0.01053883 0.001126512    da1-1
3 120   5 0.10211586 0.005986254 0.1468009 0.004522738 0.01273033 0.001277010       bb
4 120   5 0.10938800 0.006663103 0.1560210 0.015423139 0.01382478 0.001893295  da1-1bb
5 168   7 0.24769211 0.014692246 0.3162221 0.016811098 0.06381803 0.006592822       WT
6 168   7 0.29798890 0.007262811 0.3896144 0.009202582 0.09314732 0.001129070    da1-1

我可以绘制一个非常好的散点图,但得到:

  

图层错误(data = data,mapping = mapping,stat = stat,geom =   GeomErrorbar,:找不到对象'宽度'

当我运行上面的代码时。

0 个答案:

没有答案