且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用ggplot2在barplot中放置错误条

更新时间:2022-10-22 22:39:19

You should move the argument fill=variable inside the ggplot() call to ensure that geom_errorbar() also use variable as the dodging variable.

ggplot(data=dm,aes(y=value,x=concentration,fill=variable))+
  geom_bar(position = position_dodge(), 
           stat="identity") +
  geom_errorbar(aes(ymin=value-sd,ymax=value+sd),
                position=dodge,width=0.1,size=0.3)+
  ylab("mu_max [h-1]") +
  scale_x_discrete(limits=c("0","0.5x","1x","5x","10x","100x"))

相关阅读

技术问答最新文章