【发布时间】:2013-06-02 11:15:30
【问题描述】:
我想设计一个包含 36 组 3 个水平条的条形图。在每组 3 人旁边,应该有一个标签。
我的代码很乱(我第一次使用 R),所以我希望它可以处理一些虚拟数据...
无论如何:
Transcomp <- matrix(nrow=3, ncol=36) # matrix
colnamesbarplot <- colnames(transComp) # should be used as barplot labels
barplot <-
barplot(transComp,
space=c(0,2),
legend.text=TRUE,
beside=TRUE,
horiz=TRUE,
density=NA,
col=c("red1","red4","green3"),
xlab="crimes per 100,000 inhabitants",
ylab="districts and years",
axes=TRUE
)
我找不到允许我直接在条形旁边显示列名称的参数(我不在乎它们是在条形的左侧还是在右侧)... 问题可能出在绘制的条数上吗?
add text to horizontal barplot in R, y-axis at different scale? 和 labeling in barplot() 和 Axis labels for each bar and each group in bar charts with dodged groups 中的答案无法让我到达我想得到的地方...
感谢您的帮助!
【问题讨论】: