On Wed, Aug 11, 2010 at 10:14 PM, Brian Tsai <btsa...@gmail.com> wrote:
> Hi all,
>
> I'm interested in doing a dot plot where *both* the size and color (more
> specifically, shade of grey) change with the associated value.
>
> I've found examples online for ggplot2 where you can scale the size of the
> dot with a value:
>
> http://had.co.nz/ggplot2/graphics/6a053f23cf5bdfe5155ab53d345a5e0b.png
>
> Or scale the color with the value:
>
> http://had.co.nz/ggplot2/graphics/b17bf93530ff6695afb366e65677c17f.png
>
> both of which are from here:
> http://had.co.nz/ggplot2/geom_point.html
>
> but I've been playing around with ggplot2 and couldn't figure out how to do
> both at the same time - ideally i want size to increase with a value, and
> the shade of grey to get lighter with increasing value.

qplot(mpg, wt, data = mtcars, colour = qsec, size = qsec) + scale_colour_grey()

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

______________________________________________
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.

Reply via email to