I want to design a barplot with 36 groups of 3 horizontal bars. Next to each group of 3, there should be one label.
My code is quite messed up (first time I use R), so I hope it will work with some dummy data...
Anyways:
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
)
I cannot find the paramenter that allows me to show a names of the columns directly next to the bars (I do not care whether they are on the left or on the right of the bars)... Could the problem maybe be the number of bars plotted?
The answeres in add text to horizontal barplot in R, y-axis at different scale? and labeling in barplot() and Axis labels for each bar and each group in bar charts with dodged groups don't get me where I wanna get...
Thank you for any help!