I would guess that the (very faint) stripes come from the estimation of density which is done at a fixed number of points (512 by default). Unfortunately you cannot adjust it through stat_density so you'll probably have to recompute the density yourself if 512 is not enough for you.
Here is a simpler example showing the effect of the number of points at which density is estimated:
data <- rnorm(100, -0.8, sd=sqrt(0.05))
dens <- density(data)
dens <- data.frame(x=dens$x, density=dens$y)
dens30 <- density(data, n=30)
dens30 <- data.frame(x=dens30$x, density=dens30$y)
dens1000 <- density(data, n=1000)
dens1000 <- data.frame(x=dens1000$x, density=dens1000$y)
ggplot(dens) + geom_tile(aes(x=x, y=1, fill=density)) + scale_fill_gradient(low = "white", high = "black")
ggplot(dens30) + geom_tile(aes(x=x, y=1, fill=density)) + scale_fill_gradient(low = "white", high = "black")
ggplot(dens1000) + geom_tile(aes(x=x, y=1, fill=density)) + scale_fill_gradient(low = "white", high = "black")
I personally see very little difference between the default (512) and 1000, even on a very good and colour-calibrated screen, so I doubt this would show in real life, especially on print.
Jean-Olivier Irisson
---
Observatoire Océanologique
Station Zoologique, B.P. 28, Chemin du Lazaret
06230 Villefranche-sur-Mer
Tel: +33 04 93 76 38 04
Mob: +33 06 21 05 19 90
http://jo.irisson.com/
Dear all,
I have found the solution and just wanted to share it. In fact, the problem was not directly R-related, but it's got something to do with my pdf viewer or rather graphical settings in general (it also affects the R plotting window). That is also why Jean-Olivier did not see a big difference between the plots, but I still did. I've attached a screen shot to show what I meant when I talked about stripes.
I found the solution here: http://r.789695.n4.nabble.com/ggplot-with-geom-tile-td4176038.html
When using a different pdf viewer the result was fine.
Cheers
Anne.
> > Observatoire Océanologique