[R] Grouped bars in barplot
Steve Murray
smurray444 at hotmail.com
Thu Jan 13 00:14:10 CET 2011
Dear all,
I am trying to make a barplot with clustered pairs of bars, using class=numeric data and the following command:
barplot(c(bline_precip[10,9], bline_runoff[10,9], cccma_precip[10,9], cccma_runoff[10,9], csiro_precip[10,9], csiro_runoff[10,9], ipsl_precip[10,9], ipsl_runoff[10,9], mpi_precip[10,9], mpi_runoff[10,9], ncar_precip[10,9], ncar_runoff[10,9], ukmo_precip[10,9], ukmo_runoff[10,9]), beside=TRUE, space=c(0,2))
This results in all bars being packed tightly together, but with no gap between each pair. I suspect the problem is something to do with the data not being a matrix, but I've tried using as.matrix for each data element and this doesn't seem to work. If any one has any suggestions I'd be very grateful to hear them.
Also, I'm hoping to put a label beneath each pair of bars on the x-axis, in the centre. At present I can only get labels to appear directly underneath a single bar, as opposed to the centre of the pair of bars. Does anyone have any suggestions for solving this?
Many thanks for any help offered.
Steve
More information about the R-help
mailing list