[R] Barplot Labels Problem

Jim Lemon jim at bitwrit.com.au
Sat Oct 25 13:16:13 CEST 2008

Rodrigo Aluizio wrote:
> Hi everybody,
> well I'm trying to use barplot for the first time. I get a suitable graphic but I'm having a weird problem.
> My graphic is generated from a matrix with several species (rowNames) and two abundance columns.
> So each species will have two bars, and the species name should appear at left. Until now everything is Ok, but when a I plot it the species names (my labels) are cut by device limits, and only part of the names appear.
> I could move them with the command "line=some negative value", but the axis (x and y) stay put and the things get over each other (the command 'line' works, but a error saying that it's not a graphic parameter appears). In addition, but with less importance, how could I remove the legend borders? And why, when I try use the 'width' command it fails to raise the width of the bars and I get and error saying that its not a graphic parameter (the command is in barplot help!!)?
> I'm using R 2.8.0 at Windows XP 32 bits.
> Here is the code I'm using, where MainSpp is my matrix:
> barplot(MainSpp,horiz=T,beside=T,main='Main Species',xlab='%',las=1,
> legend.text=T,width=5,cex.names=0.8)
Hi Rodrigo,
I think that the staxlab function in the plotrix package might do what 
you want.

For the legend problem, I would suggest not using the barplot legend 
option but using the legend function with bty="n".


More information about the R-help mailing list