I am trying to create an array of rows (1 row, 3 columns) that have the same column width .
All three bar sections have a different number of observations and, therefore, the width of the bars is ultimately different for each section (that is, the section with the largest number of observations has narrow bands and the section with the least number of observations has the widest bands). I understand from the barplot {graphics} R documentation that
"Specifying a single value will not have a visible effect unless xlim specified"
However, my x labels are strings, so I'm not sure how to specify xlim . I do not mind if my stories have different widths, but is it necessary to indicate this anyway?
Here are some fake data and the code I use ... thanks for your help.
height4plot1 <- c(1,6,9,2,3,10,7,15) names4plot1 <- c("P1","P2","P3","P4","P5","P6","P7","P8") height4plot2 <- c(5,4,10,2) names4plot2 <- c("M1","M2","M3","M4") height4plot3 <- c(4,12) names4plot3 <0 c("U1","U2") par(mfrow=c(1,3), mar=c(10,5,2,1), cex.axis=0.7, mgp=c(3,0.5,0)) barplot(height4plot1, names.arg=names4plot1, las=3, axes=TRUE, axisnames=TRUE, ylab="YLAB", ylim=ylim, plot=TRUE, main="PLOT1", width=1) barplot(height4plot2, names.arg=names4plot2, las=3, axes=TRUE, axisnames=TRUE, ylim=ylim, plot=TRUE, main="PLOT2", width=1) barplot(height4plot3, names.arg=names4plot3, las=3, axes=TRUE, axisnames=TRUE, ylim=ylim, plot=TRUE, main="PLOT3", width=1)