> I have recently been introduced to the ggplot package by Hadley Wickham > and must say I am quite impressed so far at how easy it is to make > attractive plots, but one thing I am struggling over is how to > consolidate legends.
It's not currently possible to consolidate them (although in the distant future that would be something nice to have), but you can turn them off: hide_colour <- scale_colour_continuous() hide_colour$legend <- FALSE p <- ggplot(data = mtcars) + geom_point(mapping = aes(x = hp, y = mpg, colour = cyl)) + hide_colour You'll also need to twiddle your viewports a little so that you still have space for the viewport, since space will not be allocated automatically anymore. The next thing is to extract the grob for the legend itself - this is a little tricker, because there's currently no way to get at the scales after they have been "trained" with the data. Load get_legends from http://pastie.textmate.org/95755, and then you can do: grid.newpage(); grid.draw(get_legends(p)) If you're not familiar enough with grid to stitch all of these pieces together, please let me know, but this should be enough to get you started. Hadley ______________________________________________ R-help@stat.math.ethz.ch 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.