Hi,
under R 2.14, I used ggplot2 to create a plot matrix. I used
scale_x_continuous(trans="log10") to get the axis in log-scale. Now
(four months later; unter R 2.15.0), I ran the same code again and
realized that the axis scale is not correct anymore (the labels are
overplotted as well, one even shows the wrong number but I guess
that's due to some clipping). I then installed ggplot2 with devtools
(see
https://gist.github.com/1150934) because I remember that this
once (under R 2.14) solved some of my problems (thanks to Kohske for
the advice). I was hoping this would solve the problem again under
2.15, but it didn't. I am wondering why my former code is not working
anymore.
I checked one of my former minimal examples I posted (see
https://groups.google.com/group/ggplot2/browse_thread/thread/74ded9936428b17e
but also below), and when I ran it, it reproduced the problem. How can
I get the x-axis in log-scale?
In case this minimal example does not reproduce non-log-x-scale for
you, please let me know. I can provide a screen shot.
Cheers,
Marius
Note that I'm working on Mac OS X 10.7.3.
require(ggplot2)
require(reshape2)
require(plyr)
## parameters of some model
p1 <- c(20, 50, 100, 200)
p2 <- c(5, 10, 20, 50, 100)
p3 <- c("group.1","group.2","group.3","group.4","group.5")
p4 <- c(0.2, 0.5, 0.8)
## replications
N <- 1000
## lengths
l1 <- length(p1)
l2 <- length(p2)
l3 <- length(p3)
l4 <- length(p4)
## build result array containing the measurements
arr <- array(rep(NA, l1*l2*l3*l4*N), dim=c(l1, l2, l3, l4, N),
dimnames=list(
p1=p1,
p2=p2,
p3=p3,
p4=p4,
N=1:N))
## fill the result array (dummy here) with values
for(i in 1:l1){
for(j in 1:l2){
for(k in 1:l3){
for(l in 1:l4){
arr[i,j,k,l,] <- i+j+k+l+runif(N)
}
}
}
}
## create molten data
mdf <- melt(arr, formula = . ~ + p1 + p2 + p3 + p4 + N) # create
molten data frame
mdf <- mutate(mdf, p12=p1*p2) # add p1*p2
## build means (dummy function here)
mdf.mean <- dcast(mdf, p1 + p2 + p12 + p3 + p4 ~ "Value",
fun.aggregate=mean, value_var="value")
str(mdf.mean)
## plot
p <- ggplot(mdf.mean, aes(x=p12, y=Value, colour=p1)) +
geom_line(aes(group=p1)) + geom_point() +
facet_grid(p3 ~ p4, scales = "free_y") +
scale_x_continuous(trans="log10")
p