[R] quick square root axes

baptiste auguie ba208 at exeter.ac.uk
Tue May 5 20:20:47 CEST 2009

On 5 May 2009, at 19:28, Duncan Murdoch wrote:

> 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 ?

Have you tried ggplot2? I think Hadley has given a lot of thinking on  
this sort of issues.



> 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
> other scales.
> Duncan Murdoch
> ______________________________________________
> 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.


Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,

Phone: +44 1392 264187


More information about the R-help mailing list