[R] How to vary the distance between the pairs of a side-by-side barplot?

Michael Eisenring eimichae at ethz.ch
Thu Aug 25 10:45:27 CEST 2011


Hello,
for my project I wanted to create a side-by-side barplot. For each of 143 treatments there are always two measurement. This two measurements (a pair) are represented by a red resp. a yellow bar. I was able to write the code for the side-by-side barplot. Unfortunately however I am not able to  vary the distance between the measurement pairs ( the distance from one red-yellow bar pair to the next). How can I do this in the case of a side-by-side barplot? 
In a normal barplot this can be done by using the command: "space()" but in the case of a side-by-side barplot it is not working( in fact if I work with the "space" command R is changing somehow the coloration of my bars).
I would be very grateful if anyone could help me with my problem.
Thank you very much

My R code:

barplot(t(data), beside = TRUE,ylim=c(0,200),col=c("red","yellow"),main="Species rank curve",ylab="Number of individuals")

Yours sincerely
M.Eisenring

PS: This is the first time I am using the R mailing list. Please let me know if I made any mistakes regarding the manner in which questions should be asked etc.


More information about the R-help mailing list