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

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Thu Aug 26 11:26:49 CEST 2004


Nope.

Even after par(las=3, mar=c(15,4,4,2)), it doesn't draw the labels, and
at those margins the plot os all skwished up.

I guess if I keep enlarging the margins then it maybe will draw my
labels, but what use is that?  What I would like it to do is simply try
and squeeze the labels into the available space.  It looks like what it
is doing (on linux only, not on windows) is deciding there isn't enough
space and therefore not drawing the labels.

-----Original Message-----
From: Uwe Ligges [mailto:ligges at statistik.uni-dortmund.de] 
Sent: 26 August 2004 10:15
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:

> 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