[R] ggplot2 - help with intervals in geom plot

hadley wickham h.wickham at gmail.com
Tue Apr 27 17:37:18 CEST 2010


> The problem is that I want HCount and HProbCount to use custom
> gradients. i.e. a colour for 0-10, next shade for 10-30, next for 30-70
> etc.

Use cut to create factor with those levels, and then scale_fill_manual
to match values to colours.

> Due to some magic done on the data, one uses intervals 0,50,100,150 and
> the other 0,20,40 etc. - not important but I would be interested to know
> why. My plots are created by;

The breaks on the legend are just labels - it really is an underlying
smooth gradient.  If you want to ensure that the limits of the scale
are the same for both plots, use the limits argument.

Hadley

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



More information about the R-help mailing list