[R] quick square root axes
Carl Witthoft
carl at witthoft.com
Thu May 7 01:04:02 CEST 2009
Here's a Q&D bit of code I wrote up a while back. Dunno if it'll be of
any use in setting up your tickmarks.
# x, n same meaning as in pretty()
# update: check for x neg or zero
# ... is for other args to pretty()
prettylog<- function(x,n=10,base=10,...) {
x<-unlist(x)
if (min(x)<=0) {
print("Warning: nonpositive values removed")
x<-x[c(x>0)]
# just to avoid a single-value fed to pretty()
if(length(x)==1) x<-c(1,x)
}
return((base^(pretty(log(x,base=base),n=n,...))))
}
More information about the R-help
mailing list