[R] Barplot Labels Problem
Rodrigo Aluizio
r.aluizio at gmail.com
Sun Oct 26 13:48:43 CET 2008
Thanks for the help Jim,
The legend function solved the legend border problem but the labels, even
using staxlab from plotrix are still being cut by the device limits, like
there is some kind of character number limits or something like that.
Anyway thank you so much, I'll keep trying and searching.
Rodrigo.
--------------------------------------------------
From: "Jim Lemon" <jim em bitwrit.com.au>
Sent: Saturday, October 25, 2008 9:16 AM
To: "Rodrigo Aluizio" <r.aluizio em gmail.com>
Cc: "R Help" <r-help em r-project.org>
Subject: Re: [R] Barplot Labels Problem
> 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 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".
>
> Jim
>
More information about the R-help
mailing list