[R] Barplot Labels Problem

Duncan Murdoch murdoch at stats.uwo.ca
Wed Nov 5 13:51:37 CET 2008


On 05/11/2008 7:16 AM, Rodrigo Aluizio wrote:
> Hi List, well I’ve already asked this before, but I can’t figure out a
> solution for the problem after trying many different ways.
> 
> So I writing again…
> 
> I’m using barplot function. I pretend to create a horizontal barplot with
> two different information (side by side) for a species list. Well I can
> generate the graph easily, but the problem is that the labels with the
> species names are cut by device window!! I’ve tried lots of par functions
> none seems to work properly.
> 
> Below are the script.
> 
>  
> 
> Height is a matrix of species and two column of numerical data. I used
> par(las=) function to make the labels horizontal. When I do this they are
> cut by the device window. If I don’t do that the label stay vertical and
> make nonsense with the graph.

You probably want a larger left margin.  That means increasing the 
second component of par("mar").

I'd demonstrate, but your example code isn't reproducible.

People:  you get much better answers if you post code that is easy for 
others to run.  Then they can modify it and you'll get an example that 
works, rather than speculation about what might work.  Don't rely on 
non-base packages (unless you are asking about one of them); don't post 
huge datasets or huge R scripts.  Work out what is the essence of your 
question, and extract the code to show just that.

Duncan Murdoch

> 
>  
> 
> library(xlsReadWrite)
> 
> Spp<-read.xls('SppPrincipaisFVeFT.xls',sheet=1,rowNames=T)
> 
> Spp<-as.matrix(Spp)
> 
> barplot(t(Spp),axis.lty='solid',horiz=T,beside=T,las=1,col=c('lightgray','bl
> ack'),main='Main Speceis')
> 
> legend('topright',c('Living Fauna','Dead
> Fauna'),fill=c('lightgray','black'),bty='n')
> 
>  
> 
> Thanks for your attention
> 
>  
> 
> ___________________________________
> MSc.  <mailto:r.aluizio at gmail.com> Rodrigo Aluizio
> Centro de Estudos do Mar/UFPR
> Laboratório de Micropaleontologia
> Avenida Beira Mar s/n - CEP 83255-000
> Pontal do Paraná - PR - BRASIL
> 
> 
> 	[[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list