ggplot错误栏是水平的,但应该是垂直的

时间:2016-04-25 20:01:00

标签: r plot ggplot2

我使用包含错误栏的ggplot创建了两个图。我的第一个绘图显示了垂直方向上的错误栏,就像它们应该的那样,但是第二个绘图使它们面向水平,即使我使用了相同的代码。如何更改误差线的方向?它们都应该垂直运行。

情节1:

head(arsum)
    ss   BV   N    a_rmse        sd          se          ci
1  300 .053 600 0.4490948 0.1939080 0.007916261 0.015547000
2  300 0.11 600 0.4326376 0.1876572 0.007661074 0.015045831
3  300 0.25 600 0.4028272 0.1758211 0.007177866 0.014096842
4  300 0.43 600 0.3736950 0.1587006 0.006478925 0.012724171
5  300 1.00 600 0.3328419 0.1163379 0.004749474 0.009327646
6 1000 .053 600 0.3211591 0.1379862 0.005633262 0.011063344

ggplot(data=arsum, aes(x=BV, y=a_rmse, color=ss, group=ss))+
   geom_errorbar(aes(ymin=a_rmse-se, ymax=a_rmse+se), width=.1)+
   geom_point()+
   geom_line()+
   geom_hline(yintercept=0)+
   ggtitle("Interaction Plot Single Level Discrimination")+
   xlab("ICC")+
   ylab("Discrimination RMSE")+
   labs(colour = "Sample Size") 

情节2:

head(twsum)
   ICC items    N    w_rmse         sd           se           ci
1 0.05    10 2915 0.7025752 0.02322448 0.0004301566 0.0008434419
2 0.05    20 2905 0.6053087 0.02072466 0.0003845158 0.0007539515
3 0.05    50 2863 0.4738864 0.02033279 0.0003800024 0.0007451061
4 0.05    70 2849 0.4368722 0.02125809 0.0003982703 0.0007809273
5  0.1    10 2878 0.7155422 0.02341178 0.0004364043 0.0008556967
6  0.1    20 2907 0.6272082 0.02283895 0.0004235978 0.0008305823

ggplot(data=twsum, aes(x=ICC, y=w_rmse, color=items, group=items))+
    geom_errorbar(aes(ymin=w_rmse-se, ymax=w_rmse+se), width=.1)+
    geom_point()+
    geom_line()+
    geom_hline(yintercept=0)+
    ggtitle("Interaction Plot Single Level Within-cluster Theta RMSE")+
    xlab("ICC")+
    ylab("Within-cluster Theta RMSE")+
    labs(colour = "Number of \nItems") 

0 个答案:

没有答案
相关问题