[R] ggplot2 setting colors for individual groups.

Dennis Murphy djmuser at gmail.com
Tue Aug 9 19:58:54 CEST 2011


Hi:

You could always try cut() to discretize a continuous variable and
then apply your vector of set colors to the discretized variable in
ggplot2's scale_*_manual().

HTH,
Dennis

On Tue, Aug 9, 2011 at 9:26 AM, Adrienne Wootten <amwootte at ncsu.edu> wrote:
> All,
>
> I'm working with ggplot2 to produce some graphics that will be part of
> my master's thesis.  Here's what I would like to do here, (attached is
> an example of how far I've gotten).
>
> I'm working on mapping the values of several different parameters for
> each station in my study.  So far I've been working with
> scale_color_gradientn to handle the coloring.  What I would like to do
> is rather than have a smooth color gradient, I would like make the
> values between A and B a set color, between B and C another color, and
> so on.  That's where I'm having an issue, because the values are all
> continuous data, and it seems like the only thing which will let me
> get anything close to what I would like (such as scale_color_manual)
> requires a discrete dataset.
>
> I've reached an impasse with this and could really use some advice.
> Thanks everyone!
>
> A
>
> --
> Adrienne Wootten
> Graduate Research Assistant
> State Climate Office of North Carolina
> Department of Marine, Earth and Atmospheric Sciences
> North Carolina State University
>
> ______________________________________________
> 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.
>
>



More information about the R-help mailing list