[R] quick square root axes
murdoch at stats.uwo.ca
Tue May 5 19:28:50 CEST 2009
On 5/5/2009 1:05 PM, Markus Loecher wrote:
> Dear R users,
> while I enjoy the built-in log argument to the plot() function, I wished it
> would be as easy to create more general custom transformed axes such as
> sqrt(), logit, etc...
> for example, instead of
> plot(x=exp(rnorm(10)), y=(1:10)^4, log = "xy"), sth. along the lines of
> plot(x=exp(rnorm(10)), y=(1:10)^4, trans = list(x = log, y = sqrt))
> to encode the desired transfomation.
> This involves just transforming the xy values and creating nice tick marks
> at the appropriate positions.
> Before trying to write my own function, I wanted to see if that
> functionality already exists in another package ?
I don't know of such a thing, but it may well exist.
If you do write your own, the hardest part will be picking the nice tick
marks. They should be approximately evenly spaced, but at nice round
values of the original variable: that's hard to do in general. R has
the pretty() function for the linear scale, and doesn't do too badly on
log axes, but you'll need to work out your own rules for the sqrt or
More information about the R-help