R中并排的多个条形图 [英] multiple barplots in R side by side
本文介绍了R中并排的多个条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个这样的向量:
multistakeuserutil<-c(24.0, 71.0, 75.0, 109.0, 134.0, 126.0, 117.0, 446.0, 283.0, 162.0, 109.0)
reguserUtil<-c(10.0, 50.0, 38.0, 67.0, 73.0, 72.0, 69.0, 263.0, 146.0, 87.0, 70.0)
现在,我使用此行代码来绘制multistakeuserutil:
Now, I plot multistakeuserutil using this line of code:
barplot(multistakeuserutil,col="darkgreen")
然后我像这样绘制reguserUtil:
And then I plot reguserUtil like this:
barplot(reguserUtil,col="red")
这给了我一个单独的情节. 但是我希望将这两个条形图放在一张图片中并排放置以便于比较.知道我该怎么做吗?
which gives me a separate plot. But I want this two bar chart to be in one picture and side by side for easier comparison. Any idea how I can do that?
推荐答案
这可能对您有用.
test <- cbind(multistakeuserutil,reguserUtil)
barplot(test,beside=T)
如果您想做更好的比较,那对我来说是最好的.
If you want to do better comparison, then this is best according to me.
test2 <- rbind(multistakeuserutil,reguserUtil)
barplot(test2,beside=T)
这篇关于R中并排的多个条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文