Skip to content

ggplot2 setting colors for individual groups.

2 messages · Adrienne Wootten, Dennis Murphy

#
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
#
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: