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

Sebastian Weber sebastian.weber at physik.tu-darmstadt.de
Tue Oct 24 19:16:32 CEST 2006


Hello,

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 can produce plots as I want, if I transform all values before
plotting, like this:

pl2 <- qplot(log10(correlFunc), log10(correlFunc.ref), data=all)
pl2 <- ggabline(pl2, slope=1, intercept=0)
print(pl2) ## ah, I see the line, cool!

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?

Well, my versions are ggplot 0.4.0, R 2.3.1 on ubuntu edgy.

Thanks a lot in advance for your help.

Greetings,

Sebastian Weber



More information about the R-help mailing list