[R] Plotting pairs of bars

Jim Lemon jim at bitwrit.com.au
Wed May 6 12:47:07 CEST 2009


Steve Murray wrote:
> Thanks for the reply - the 'beside' argument certainly looks useful, although I'm still not getting the output I'd hoped for.
>
> By doing: barplot(combine86[,1:2], beside = TRUE, las = 1, xlab=rownames(combine86))
> ...I get all the bars for the 'Sim Mean' column plotted on the left side of the graphics device and all the bars for the 'Obs Mean' clustered on the right side.
>
> Ideally I'd like bar 1 to be from 'Sim Mean' for Amazon and then bar 2 for 'Obs Mean' for Amazon. Then there would be a small gap separating the Amazon from the next pair of bars of the next river (Nile). Then it would be the 'Sim Mean' value for Nile, followed by the 'Obs Mean' value for Nile, then a gap, then onto the next river and so on.
>   
Hi Steve,
Try transposing:

barplot(t(combine86[,1:2]),...)

Jim




More information about the R-help mailing list