[R] ggplot2 qplot and add
h.wickham at gmail.com
Sat Aug 4 06:14:01 CEST 2007
On 8/2/07, Emilio Gagliardi <emilio at ualberta.ca> wrote:
> Hi Thierry and Hadley,
> Thanks for your help! I got it working almost 100% to what I want. My last
> questions are simple I think ;)
> 1) How can I pass a label to colour and assign the color at the same time?
> The auto-selection of colors is awesome for learning, but makes it harder to
> see some patterns.
I'm not sure what you mean? Could you provide an example?
> 2) in regards to 1), where can I find a list of the possible values that can
> be passed to colour=""? I've seen in some examples "gray50" but when I try
> it, it doesn't come out gray50, it just prints that as the label. For
> example, in my case, I could have 4 colors with 4 different shades of each.
> Or maybe I can use word length and gray scale, and make longer words darker,
I will try and explain this more in the book - but there's a
difference between mapping and setting. In qplot values are always
mapped (this is usually what you want - you want to specify the raw
values and have them automatically mapped to sensible visual
properties). If you manually add on geoms you can map or set:
* mapping: + geom_point(aes(colour = "Treatment A"))
* setting: + geom_point(colour = "green")
Note in the second case, the colour must be a valid R colour.
More information about the R-help