[R] Better y-axis labels, and x-axis scaling

Ben Bolker bolker at zoo.ufl.edu
Fri Nov 3 00:10:33 CET 2006


Andre Nathan <andre <at> digirati.com.br> writes:

> 
> Hello
> 
> I'm plotting some data using matplot with a logarithmic scale on the
> y-axis. This is the call to matplot I'm using:
> 
>   matplot(turns, distances, type = "l", log = "y", lty = "solid",
>           ylab = "", xlab = "Time steps", col = c("black"))
> 


  Hmmm.  What do you mean by "not very nice"?  This graph
seems (to me) to be a typical logarithmic scaling axis.
If you really wanted equal scaling you could do

matplot(...,axes=FALSE)
axis(side=1)
pvec <- 10^seq(-3,-1,by=0.5)
axis(side=2,at=pvec,labels=round(pvec,3))
box()

 or something like that...

  warning, totally untested ...

  (the only way I can think of to get "pretty"
and equally spaced ticks is to use ONLY powers
of ten ...)

  Ben Bolker



More information about the R-help mailing list