[R] [ggplot] trouble with ggabline and log-log-plots

Sebastian Weber sebastian.weber at physik.tu-darmstadt.de
Wed Oct 25 09:25:08 CEST 2006


> Yes, but for abline (the way it is currently written) to work out
> where that line should go, uses the equation y = mx + c.  In this
> case, where c = 0, or -infinity on the log scale, y is going to be
> -infinty for the entire range of x's.   I don't see how to interpret
> the specification in a consistent manner otherwise.

Ah, I start seeing the point. What I actually want to verify is the
power-law. So in a log-log case the line would mean in the lin-lin world
a relation y = a x^b which will become log(y) = log(a) + b log(x).
Nevertheless I see the problem, that for any transformation, one would
need a different function which ggabline uses. One possible ansatz would
be to let ggabline plot the function y' = m x' + c where y' and x' are
the transformed variables log(y) and log(x) (or whatever else
transformation is in use). This should yield straight lines with
whatever transformation one uses, if I don't miss anything.

> 
> > I wrote some functions which do produce nice tick-marks with
> > lattice-plots, but the syntax is really messy. However, my functions can
> > produce lists with at and label members with according ticks. If you
> > like, I sent them to you along with an example plot.
> 
> Yes, I'd like to see them.  If the algorithm is good, I'm happy to
> clean up the code and include it.

Ok, I will send you my code directly.

Greetings,

Sebastian Weber

> 
> Regards,
> 
> Hadley



More information about the R-help mailing list