Re: [R] abline in log-log power law plot

From: hadley wickham <>
Date: Fri, 22 Feb 2008 16:21:50 -0600

On Fri, Feb 22, 2008 at 2:38 PM, martin klein <> wrote:


> I have a power law plot in log-log scale using plot(x,y,log="xy") but I
> can't get the regression line to plot correctly.
> abline(lm(log(y)~log(x))) plots a straight line that looks promising but
> the intercept with the y-axis seems to be way off.
> summary(lm(log(y)~log(x))) gives the values but i cant really make any
> sense out of it.
> fitted(..) just confirms the values that seem to be incorrect.
> any help is appreciated.
> thanks!

You might try using ggplot2 instead:


qplot(x, y, log="xy") + geom_smooth(method = lm)



______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 22 Feb 2008 - 22:24:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 22 Feb 2008 - 23:30:16 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive