will limits set in scale_colour_gradient() hide points beyond range? or use just gray color?

352 views
Skip to first unread message

Tengfei Yin

unread,
Apr 1, 2012, 5:08:37 AM4/1/12
to ggplot2
Hi dear list,

on the on-line documents, in those annotation of the codes, it looks like points will not be plotted.

# Tweak scale limits. Any points outside these limits will not be # plotted, and will not affect the calculation of statistics, etc d + scale_colour_gradient(limits=c(3, 10))


but following codes still keep those points outside the range, and it's in gray color

p <- qplot(wt, cyl, data = mtcars, colour = cyl)
p
## p + scale_colour_gradient(breaks = c(5.5, 6.5))
p + scale_colour_gradient(limits = c(5.5, 6.5))

Could anybody produce the same results?

Thanks

Tengfei
> sessionInfo()
R Under development (unstable) (2012-02-19 r58417)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=zh_CN.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_0.9.0

loaded via a namespace (and not attached):
 [1] colorspace_1.1-1   dichromat_1.2-4    digest_0.5.2       grid_2.15.0       
 [5] MASS_7.3-17        memoise_0.1        munsell_0.3        plyr_1.7.1        
 [9] proto_0.3-9.2      RColorBrewer_1.0-5 reshape2_1.2.1     scales_0.2.0      
[13] stringr_0.6  

--
Tengfei Yin
MCDB PhD student
1620 Howe Hall, 2274,
Iowa State University
Ames, IA,50011-2274
Homepage: www.tengfei.name


Kohske Takahashi

unread,
Apr 2, 2012, 1:22:23 AM4/2/12
to Tengfei Yin, ggplot2
At the moment, you can surpress by:

p + scale_colour_gradient(limits = c(5.5, 6.5), na.value = NA)

again, here is some confusion in handling actual NA and out-of-range.
It will be fixed in the future version.


2012年4月1日18:08 Tengfei Yin <yinte...@gmail.com>:

> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2

--
--
Kohske Takahashi <takahash...@gmail.com>

Research Center for Advanced Science and Technology,
The University of Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html

Tengfei Yin

unread,
Apr 2, 2012, 1:59:23 AM4/2/12
to Kohske Takahashi, ggplot2
I see, thanks!
Reply all
Reply to author
Forward
0 new messages