[R] Using ggplot2 I need to move the location of legend to on the plot

Juliet Hannah juliet.hannah at gmail.com
Sat Jan 31 17:14:24 CET 2009


Try these options:

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

On Fri, Jan 30, 2009 at 5:53 PM, Jason Rupert <jasonkrupert at yahoo.com> wrote:
>
> Thanks again for the hints about adding the vertical line to the hist plot and in ggplot.  That worked great.
>
> Based on that advice I've been flipping through the ggplot2 doc and ggplot-static\index.html webpage more looking for the answer to the next question.
>
> Unfortunately, I haven't stumbled on a description of how to move around the location of the legend.
>
> Here is what I have so far:
> qplot(Age, data = combined_data, binwidth = 1,
>          fill = combined_data$Type) +
>          scale_x_continuous("Age") + scale_y_continuous("Freq") +
>          scale_fill_discrete("Type")
>
> I'm guessing there is a way to move the legend some place  thanks again.
>
>
>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>
>




More information about the R-help mailing list