【发布时间】:2015-09-20 10:16:53
【问题描述】:
所以我有这个数据表
AA BB CC DD
W1 3.5 3.5 3.4 3.5
w2 3.4 3.7 3.6 3.5
w3 3.5 3.4 3.5 3.5
w4 3.5 3.4 3.5 3.5
w5 3.5 3.4 3.5 3.5
w6 3.5 3.4 3.5 3.5
w7 3.5 3.4 3.5 3.5
w8 3.5 3.4 3.5 3.5
和代码
qw<-barplot(as.matrix(t(tabela.matrix1)), beside=TRUE,
col=c("yellow", "cornflowerblue", "yellowgreen","orchid4"))
text(qw, 0, round(as.matrix(t(tabela.matrix1)), 1),cex=1,pos=3,srt=90)
#legend("bottom",
# c("AA","BB","CC", "DD"),
# fill=terrain.colors(4)
)
现在我想绘制这个条形图,将图例放在条形图之外,并将字母 w1、w2、w3、w4... 旋转 45 度。:
上面的图片是用excel创建的。
【问题讨论】:
-
有关您的图例,请参阅stackoverflow.com/questions/3932038/…,即您也可以使用
xpd作为标签。试试mat <- as.matrix(t(tabela.matrix1)) ;qw <- barplot(mat, beside=TRUE, axisnames = FALSE, col=c("yellow", "cornflowerblue", "yellowgreen","orchid4")) ; text(colMeans(qw[2:3,]), -0.25, labels = colnames(mat), xpd=TRUE, srt=45); legend(1,-0.5, c("AA","BB","CC", "DD"), fill=terrain.colors(4), horiz=TRUE, xpd=TRUE) -
@user20650,谢谢。这很有帮助。
-
不客气......请随时扩展它并将其添加为答案
标签: r