Dear Paul and others, It also happens with the examples from Hadley geom_tile() on: http://had.co.nz/ggplot2/geom_tile.html <http://had.co.nz/ggplot2/geom_tile.html> With this example I do not get the white lines: p <- ggplot(data = tot, mapping = aes(x = temp, y = precip)) p + layer(data = tot, mapping = aes(colour = dis, fill = dis), geom = "tile", stat = "identity") But in this example I don't have the colours going from red (10000) to white, to blue (22000). My SessionInfo() sessionInfo() R version 2.13.1 (2011-07-08) Platform: x86_64-pc-mingw32/x64 (64-bit)
locale: [1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252 [4] LC_NUMERIC=C LC_TIME=Dutch_Netherlands.1252 attached base packages: [1] grid stats graphics grDevices utils datasets methods base other attached packages: [1] ggplot2_0.8.9 proto_0.3-9.2 reshape_0.8.4 plyr_1.6 loaded via a namespace (and not attached): [1] digest_0.5.1 tools_2.13.1 Thank you in advance! Kind regards, Saskia ________________________________ From: Hiemstra, Paul (KNMI) Sent: Fri 09/12/2011 12:23 To: Pelt van, Saskia (KNMI) Cc: r-help@r-project.org Subject: Re: [R] ggplot with geom_tile Dear Saskia, Thank you for the reproducible example, that helps a lot. I pasted you code into R and got a perfectly fine image. You need to provide us with your sessionInfo(). Mine is listed at the end of the mail. I seem to remember having this problem with R 2.12. Therefore updating R might be a good option. hope this helps, Paul > sessionInfo() R version 2.13.0 (2011-04-13) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_US.utf8 LC_NUMERIC=C [3] LC_TIME=en_US.utf8 LC_COLLATE=en_US.utf8 [5] LC_MONETARY=C LC_MESSAGES=en_US.utf8 [7] LC_PAPER=en_US.utf8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C attached base packages: [1] grid stats graphics grDevices utils datasets methods [8] base other attached packages: [1] ggplot2_0.8.9 proto_0.3-9.2 reshape_0.8.4 plyr_1.6 fortunes_1.4-2 loaded via a namespace (and not attached): [1] digest_0.5.1 On 12/09/2011 10:33 AM, Pelt van, Saskia (KNMI) wrote: > Dear R-users, > > I am trying to make a plot with ggplot-geom_tile(), but cannot remove some > unwanted (white) lines through my plot. > > Below a reproducible example: > > ##### > library(ggplot2) > tot=as.data.frame(rep(seq(-50,50,5),each=21)) > names(tot)="precip" > temp=rep(seq(-5,5,0.5),21) > tot$temp=temp > > disc=array(dim=c(21,21)) > for(i in 1:21){ > for(y in 1:21){ > temp<- rev(seq(10000+((i-1)*500),12000+((i-1)*500),100)) > disc[i,y]=temp[y] > }} > > disc1=t(disc) > bla=as.vector(disc1) > tot$dis=bla > > cols=c("darkred"," white"," darkblue") > > p <- ggplot(tot, aes(x=temp, y=precip,group=dis)) > p+geom_tile(aes(fill=dis)) + scale_fill_gradientn(colours=cols) > ### > > This creates the plot that I want, but with white horizontal and vertical > lines that I do not need. I have tried different things, but have not found > the solution. Can you help me with this problem? > > Kind regards, > > Saskia van Pelt > > ______________________________________________ > R-help@r-project.org 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. -- Paul Hiemstra, Ph.D. Global Climate Division Royal Netherlands Meteorological Institute (KNMI) Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39 P.O. Box 201 | 3730 AE | De Bilt tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770 ______________________________________________ R-help@r-project.org 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.