Hi,
I just tried your example...
..I am not quite sure but I think there is a problem
with your example data and the axis. This has to do with
the log scale.
E.g. check your data you created with runif...
most of them are close to 1 and small values
are very very small values are very rare:
Trying your example with:
set.seed(10)
DF <- data.frame(x = runif(1000, 0.00000001, 1),
y = rnorm(1000))
range(DF$x)
For producing really small numbers one could use:
set.seed(10)
DF <- data.frame(x = exp(runif(1000, log(0.000001), log(1))),
y = rnorm(1000))
range(DF$x)
Now, plotting either of the two DFs reveals that
the axis does not explain the real extent
of the values. Resp. the range of range(DF$x) and the
range of the axis do not match (of course because the were
transformed before)...
p1 <- ggplot(DF, aes(log(x), y)) + geom_point() +
scale_x_continuous(breaks = (-6):(-1),labels = math_format(10^.x))
p2 <- ggplot(DF, aes(x, y)) + geom_point() +
scale_x_continuous(breaks = c(0.000001,0.0001,0.01,0.1),labels=math_format(10^.x),trans="log")
So far as I understand ggplot2, one need
to supply the untransformed data and set trans="log,
to get log scaled axis (as in my example before).
Now there is just the question how to get the labels
like I want them...
I'll look that up into the scales package...
Anyway thank you.... :)
/johannes
-------- Original-Nachricht --------
> Datum: Tue, 8 May 2012 05:01:19 -0700
> Von: Dennis Murphy <
djm...@gmail.com>
> An: Johannes Radinger <
JRad...@gmx.at>
> CC:
ggp...@googlegroups.com
> Betreff: Re: scientific notation: 10^-8 instead of 10e-08