What color scale should be used on a geom_bin2d?

387 views
Skip to first unread message

Mauricio

unread,
Feb 19, 2016, 11:19:32 PM2/19/16
to ggplot2
geom_bin2d default behavior uses light and dark colors for high and low density, respectively.  I would prefer to reverse the scale so denser areas are darker.  What color scale should be used?  And how?

Thanks

Ista Zahn

unread,
Feb 19, 2016, 11:34:49 PM2/19/16
to Mauricio, ggplot2
Use scale_fill_continuous, with whatever colors you want.

args(scale_fill_continuous)

will show you the defaults, so reversed would be

d <- ggplot(diamonds, aes(x, y)) + xlim(4, 10) + ylim(4, 10)
d + geom_bin2d() + scale_fill_continuous(low = "#56B1F7", high = "#132B43")


Or you could do

d + geom_bin2d() + scale_fill_continuous(low = "green", high = "black")

or whatever colors you prefer. See

Best,
Ista
> --
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ggplot2+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages