[R] consolidate legends in ggplot2

From: Engelmann, Bernd <Bernd.Engelmann_at_amd.com>
Date: Thu, 7 Feb 2008 10:43:55 +0100


Hello,

the same parameter for colour and shape aesthetics gives 2 legends:

library(ggplot2)
p <- ggplot(mtcars, aes(x=wt, y=mpg))
p + geom_point(aes(colour=factor(cyl), shape=factor(cyl)))

Can the 2 legends be consolidated to one with colours and shapes of the symbols matched between legend and plot ?

Thank you

Bernd Engelmann
bernd.engelmann_at_amd.com
phone: + 49-351-277-4545
fax: + 49-351-277-9-4545
AMD Saxony/AMD Saxony Limited Liability Company & Co. KG M/S E23-TY
Wilschdorfer Landstr. 101
D-01109 Dresden
Germany



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 - 09:47:57 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 Thu 07 Feb 2008 - 14:30:13 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