[R] grey colored lines and overwriting labels i qqplot2
izahn at psych.rochester.edu
Sun Jul 10 07:06:57 CEST 2011
Please give a reproducible example. Since we do not have the "test"
data we cannot run your code. One way you might do this is by posting
the output of dput(test)
On Sat, Jul 9, 2011 at 11:24 PM, Sigrid <s.stenerud at gmail.com> wrote:
> I created this graph in ggplot and added ablines to the different facets by
> specifying with subset commands. As you might see, there are still a few
> 1.) I would like to have the diamonds in a grey scale instead of colors. I
> accomplished this (see graph 2) until I overwrote the label title for the
> treatments and the colors came back (graph 1). I used these two commands:
> p=ggplot(data = test, aes(x = YEAR, y = TOTAL, colour = TREATMENT)) +
> geom_point() + facet_wrap(~country)+scale_colour_grey()+
> scale_y_continuous("number of votes")+ scale_x_continuous("Years")+
> scale_x_continuous(breaks=1:4) + scale_colour_hue(breaks='A', labels='label
> A')+ scale_colour_hue(breaks='B', labels='label B')
> How can I keep the grey scale, but avoid changing back to colors when using
> the scale_colour_hue command?
> 2.) Furthermore, only one of the overwritten labels of the treatments came
> up, despite putting in two commands (graph 1). What could have happened
> p + scale_colour_hue(breaks='A', labels='label A')+
> scale_colour_hue(breaks='B', labels='label B')
> 3.) I would like to add the lines so it matches the default grey scale
> (graph 2), but I do not know the name of the different shades in the grey
> scale. I added the lines in the following way:
>> p + geom_abline(intercept = 81.476, slope=47.267, colour = "green", size =
>> 1, subset = .(country == 'low'))+ geom_abline(intercept = 31.809,
>> slope=20.234, colour = "blue", size = 1, subset = .(country == 'low'))
> And now I would like to add lines fitting accordingly with the grey scale.
> Where can I find out the names of the grey tones?
> 4.) I would like to add different shapes. However, when I type
>>p+ geom_point(aes(shape = factor(TREATMENT))) + scale_shape(solid = FALSE)
> I get this error message:
> Error: scale_shape_discrete can deal with a maximum of 6 discrete values,
> but you have 7. See ?scale_manual for a possible alternative.
> I did not find anything useful looking at the scale_manual pages. Any tips
> on how to add another symbol?
> 5. ) Finally, how can I remove the grey background in the graph?
> Thank you for all input!
> View this message in context: http://r.789695.n4.nabble.com/grey-colored-lines-and-overwriting-labels-i-qqplot2-tp3657119p3657119.html
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
University of Rochester
Department of Clinical and Social Psychology
More information about the R-help