[R] ggplot with geom_tile
Paul Hiemstra
paul.hiemstra at knmi.nl
Fri Dec 9 12:23:11 CET 2011
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 at 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
More information about the R-help
mailing list