Skip to content
Back to formatted view

Raw Message

Message-ID: <D26692DF-3203-4BDB-88ED-8E444417AA3B@dcn.davis.ca.us>
Date: 2020-08-24T03:43:22Z
From: Jeff Newmiller
Subject: ggplot 3-color gradient scales
In-Reply-To: <CAE9tUWeL37oSTxB2GJuozEhSoFe0tbe23GXk=3EEgSGNqX=-Kg@mail.gmail.com>

Check out scale_colour_gradient2()

On August 23, 2020 8:12:06 PM PDT, April Ettington <aprilettington at gmail.com> wrote:
>Currently I am using these settings in ggplot to make a gradient from
>red
>to blue.
>
>geom_point( aes(x, y, color=z) ) +
>scale_colour_gradient(low = "red",high = "blue") +
>
>z is a ratio, and currently I am able to identify which have high and
>low
>values, but I'd really like to be able to distinguish which are >1, <1,
>or
>close to 1 by color.  It would be great if I could set a middle color
>in
>this gradient (eg. green) that is set the the value of 1, even if that
>is
>not the exact midpoint between my highest and lowest values.  Is there
>a
>way to do this in R?
>
>Thank you,
>April
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.

-- 
Sent from my phone. Please excuse my brevity.