Re: [R] consolidate legends in ggplot2

From: Engelmann, Bernd <Bernd.Engelmann_at_amd.com>
Date: Fri, 8 Feb 2008 08:31:14 +0100

Hello Hadley,

thanks again. You are right, it normally is not a good thing to fill the area with so many colours/shapes/linetypes, but in certain cases you have to do it. We sometimes have more than 30 different pointclouds on a scatterplot and the plots are still useful. These plots are analysis workhorses not intended for the presentation of results.

Bernd

-----Original Message-----
From: hadley wickham [mailto:h.wickham_at_gmail.com] Sent: Thursday, February 07, 2008 8:10 PM To: Engelmann, Bernd
Cc: r-help_at_r-project.org
Subject: Re: [R] consolidate legends in ggplot2

Hi Bernd,

> Can ggplot2 handle bigger numbers of breaks by reusing aesthetics ?

No - the attributes were fairly careful picked to actually be distinguishable, which is very hard to do above a certain number of colours/shapes/linetypes etc.

But your approach (creating your own scales) is basically correct - I will provide things that I think work best perceptually as defaults, but it should be easy for you to override them if you believe otherwise. In the latest version you can simplify your code to:

my_colour <- scale_colour_manual(values = c('green','red','blue','violet','orange2','skyblue','magenta','burlywood 1',
'cadetblue1','maroon3','aquamarine','bisque1','darkgoldenrod1','darkkhak i',
'cornsilk3', 'lightsalmon1','deepskyblue2','goldenrod1','hotpink', 'lightslateblue', 'mistyrose1','olivedrab1','plum1','pink1','orange3'))

and

my_solid_shape <- scale_shape_manual(values = c(16, 17, 15, 3, 7, 8, 16, 17, 15, 3, 7, 8, 16, 17, 15, 3, 7, 8)) my_hollow_shape <- scale_shape_manual(values = c(1, 2, 0, 3, 7, 8, 1, 2, 0, 3, 7, 8, 1, 2, 0, 3, 7, 8))

And the next version will actually be smart enough to create the obvious legend.

Hadley

--
http://had.co.nz/

______________________________________________
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.
Received on Fri 08 Feb 2008 - 07:36:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Feb 2008 - 08:30:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive