[R] Rotating the axis labels in the basic graphic device ?

Marc Schwartz marc_schwartz at me.com
Sat Jan 23 17:42:03 CET 2010


On Jan 23, 2010, at 10:25 AM, Tal Galili wrote:

> Marc,
> Following the R FAQ you linked to, I wonder how to ALWAYS have the text and the plot region fit.
> I know that if the text is too long, one can use the par(mar = c(big.number, 4, 4 ,4)) and get the text to fit.
> The question is:
> Is there a way to make the plot "know" what "big.number" should be so the text wouldn't go beyond plot regions ?
> 
> (I suspect my question might get lost inside this topic, if so - I'll repeat it with a different header)
> 
> Thanks again,
> Tal
> 

<snip>


Tal,

I suspect that you would to create an algorithm using functions such as strwidth() and strheight() to get the plot metrics for the sizes of the character labels to have a sense of how much room would be required given other parameters.

I am guessing that if you were to look at the appropriate source code in the lattice package, something along these lines is implemented there, since lattice supports rotated labels 'out of the box' and would logically have to consider these plotting characteristics at some level.

Otherwise, it is a manual tweaking process.

HTH,

Marc



More information about the R-help mailing list