Re: [R] consolidate legends in ggplot2

From: hadley wickham <h.wickham_at_gmail.com>
Date: Thu, 7 Feb 2008 13:09:59 -0600

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','burlywood1',

'cadetblue1','maroon3','aquamarine','bisque1','darkgoldenrod1','darkkhaki',
'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 Thu 07 Feb 2008 - 19:41:35 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