1
Image of sample data两种可变并排条形图ggplot
试图让并排条形图侧,但酒吧似乎是在彼此的后面,但不能让他们并排:看到图像
afg <- read.table(header=TRUE,
text="FG biomass stdev Year
1 287.6 237.5 2015
1 254.2 220.6 2016
2 309.9 126.3 2015
2 307.6 139.5 2016
3 339.6 175.5 2015
3 349.3 160.6 2016")
library(ggplot2)
ggplot(afg,aes(afg$FG,afg$biomass,fill=afg$Year)) +
geom_bar(stat="identity",position=position_dodge(0.9),color="black")
library(reshape2)
afg.long <- melt(afg$Year,id="year")
ggplot(afg.long,aes(afg$FG,afg$biomass,fill=afg$Year)) +
geom_bar(stat="identity",position = "dodge")
我已经添加了我的数据是如何设置 –
如果你点击这个数字我想它会弹出一个图片,对不起,如果我没有做这个正确的,这是我第一次 –