R Stacked Histogram
Hi Jason, You can do: qplot(mpg, wt, data = mtcars, colour = factor(cyl)) + opts(legend.position = c(0.5, 0.5)) Hadley
On Thu, Jan 8, 2009 at 3:04 PM, Jason Rupert <jasonkrupert at yahoo.com> wrote:
Thank you again for your response. This worked great. Quick question about the legend for qplot. Instead of being outside the plot, is it possible to move the location of the legend to the upper left or right corner of the plot? Could you possibly provide an example. Thank you again for your feedback and insights. --- On Wed, 1/7/09, hadley wickham <h.wickham at gmail.com> wrote: From: hadley wickham <h.wickham at gmail.com> Subject: Re: Fw: Re: [R] R Stacked Histogram To: jasonkrupert at yahoo.com, "R-help" <R-help at r-project.org> Date: Wednesday, January 7, 2009, 12:17 PM Hi Jason,
Well, one last questions about stack plot (please forgive the lame example below). I thought the below allow me to resize the the "title"
of the
stacked histogram, but no luck. Any suggestions as to the modificaiton necessary to get it to work? Right now the title is obscured by the plot and my boss will be none too happy. Thanks again.
Yes, that's a really stupid bug that I accidentally introduced in the latest version. You can fix it with: qplot(mpg, wt, data = mtcars, main = "My title") + opts(plot.title = theme_text(vjust = 0, size = 16)) or by adding a new line to the end of the title: qplot(mpg, wt, data = mtcars, main = "My title\n") Regards, Hadley -- http://had.co.nz/