[R] ggplot2: positioning legend on top of plot

From: Paul Emberson <email_at_calidasoft.co.uk>
Date: Mon, 24 Nov 2008 16:46:46 +0000


With ggplot2 v0.8, how do I position a legend on top of the plot. Things like

p + opts(legend.position="top")

work ok. But

p + opts(legend.position=c(0.5,0.5))


Error in as.character(x) :

   cannot coerce type 'closure' to vector of type 'character'

so obviously I should be giving a string instead but I can't figure out what it should be.



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 Mon 24 Nov 2008 - 16:57:38 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 Tue 25 Nov 2008 - 05:30:27 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