ggplot2:错误栏是不可见的

时间:2014-05-14 20:10:49

标签: r ggplot2

我正在尝试制作带有错误栏的条形图。当我尝试添加错误栏时,图表会相应地重新调整,但除非我通过png("example.png")等重定向输出,否则不会显示错误栏。我运行update.packages()无济于事,数据集无关紧要。这是直接从R: ggplot2 barplot and error bar复制的代码(我现在还不能发布图像)。知道为什么没有导出图像就没出现错误栏吗?

my.df <- read.table(text = "group N        val         sd         se         ci
206 3 37.2269533  7.9688645  4.6008261 19.7957568
207 3  2.0731505  2.2843009  1.3188417  5.6745180
208 3  2.2965978  1.4120606  0.8152536  3.5077531
209 3  3.1085132  1.1986664  0.6920504  2.9776525
210 3  3.3735251  1.9226134  1.1100214  4.7760365
211 3  4.0477951  2.9410503  1.6980162  7.3059739
212 3  1.2391158  1.2345554  0.7127709  3.0668055
213 2  1.3082374  1.1234220  0.7943793 10.0935460", header = TRUE)

ggplot(my.df, aes(x = factor(group), y = val)) +  
  geom_bar(position = position_dodge()) + 
  geom_errorbar(aes(ymin=val-se, ymax=val+se))

0 个答案:

没有答案