[R] Problems with par() and labels with boxplot

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Aug 26 11:14:51 CEST 2004


michael watson (IAH-C) wrote:

> Hello
> 
> I thought it was such a simple problem it didn't warrant too much
> detail!  Sorry :-)
> 
> OS is Suse Linux 8.2, R version is 1.9.0, device is x11.
> Example reproducible code:
> 
> data(InsectSprays)
> subset <- InsectSprays[1:24,]
> 
> # this creates normal horizontal text
> boxplot(count ~ spray, data = subset)
> 
> # lets try vertical text
> par(las = 3)
> boxplot(count ~ spray, data = subset)
> 
> # lets try it with long names
> par(las=3)
> boxplot(count ~ spray, data = subset, names = c('a really, really,
> really, really, really long name','a really, really, really, really,
> really long name'))
> 
> # lets try adjusting the marjins
> par(las=3, mar=c(15,4,4,2))
> boxplot(count ~ spray, data = subset, names = c('a really, really,
> really, really, really long name','a really, really, really, really,
> really long name'))
> 
> I should state at this point that on Windows, R does as would be
> expected ie it draws the labels, but they are truncated if they are too
> long.  However, on SuSe Linux, running R 1.9.0, it just doesn't draw the
> labels at all if they are too long (it does draw them if they are small
> enough to fit on the page)
> 
> Thanks
> Mick
> 
> 
> -----Original Message-----
> From: Uwe Ligges [mailto:ligges at statistik.uni-dortmund.de] 
> Sent: 26 August 2004 09:48
> To: michael watson (IAH-C)
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Problems with par() and labels with boxplot
> 
> 
> michael watson (IAH-C) wrote:
> 
> 
>>Quite a simple one really!
>>
>>When I run boxplot(), the labels on the X axis are horizontal, and I 
>>want them vertical.  So I did:
>>
>>par(las=3)
>>boxplot(...)
>>
>>And my labels just aren't there anymore....
>>
>>Any help???
> 
> 
> I guess they get clipped and you have to enlarge the margins, but you 
> haven't given sufficient details such as
> version of R, OS, device you are using, a reproducible example, ...
> 
> Please read the posting guide (see citation below).
> 
> Uwe Ligges
> 
> 
> 
>>______________________________________________
>>R-help at stat.math.ethz.ch mailing list 
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! 
>>http://www.R-project.org/posting-guide.html
> 
> 

So my guess was right and it works for you after enlarging the margins 
using par(mar = ...), isn't it?

Uwe Ligges




More information about the R-help mailing list