[R] "negative alpha" or custom gradient colors of data dots in scatterplot ?

Ista Zahn izahn at psych.rochester.edu
Mon Nov 22 18:04:59 CET 2010


Hi,
I suggest taking a look at the plotting functions in the ggplot2
package. For example:


x <- rnorm(10000)
y <- x+rnorm(10000)
dat <- data.frame(x,y)

library(ggplot2)

p <- ggplot(dat, aes(x=x, y=y))
p + geom_point() # too much overplotting: compare to
dev.new()
p + geom_hex(binwidth=c(.1,.1))

Best,
Ista

On Sun, Nov 21, 2010 at 9:13 AM, madr <madrazel at interia.pl> wrote:
>
> I know that by setting alpha to for example col = rgb(0, 0, 0, 0.1) it is
> possible to see how many overlapping is in the plot. But disadvantage of it
> is that single points are barely visible on the background. So I wonder if
> there is possible to make setting that single points would be almost black,
> but with more and more data on the same spot it would get more and more
> whiteish. Or maybe it is possible to make sole data points black but
> overlapped tending to some particular color of choice ?
> --
> View this message in context: http://r.789695.n4.nabble.com/negative-alpha-or-custom-gradient-colors-of-data-dots-in-scatterplot-tp3052394p3052394.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list