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

From: hadley wickham <h.wickham_at_gmail.com>
Date: Tue 24 Oct 2006 - 18:20:31 GMT

> I'm trying to generate a log-log plot with ggplot. Within this plot, I
> would like to draw a straight line with the help of ggabline which does
> not work. The code is
>
> pl1 <- qplot(correlFunc, correlFunc.ref, data=all, log=c("xy"))
> pl1 <- ggabline(pl1, slope=1, intercept=0)
> print(pl1) ## no line in plot :(

I'm not really sure what the correct behaviour is here. What do you expect this line to look like? It has intercept 0, which is -infinity on the log scale, so where should I start drawing the line?

> But this is definetly not nice and I cannot imagine ggplot is meant to
> be used like this. Furthermore, I would desperately like see ticks in
> the form of expression(10^2). Is there some way acheiving this without
> to much work or did I overlook an option within the docs?

You should be able to specify them explicity using pscontinuous. But in general, coming up with nice tick marks is a very difficult problem and my heuristics aren't very good. Any suggestions would be welcomed.

Hadley



R-help@stat.math.ethz.ch 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. Received on Wed Oct 25 04:25:24 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 24 Oct 2006 - 21:30:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.