Re: [R] Legend position outside

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Fri, 11 Apr 2008 12:19:24 -0600

Yes, here is one way:

> plot(1:10, pch=1:2)
> par(xpd=NA)
> tmp.u <- par('usr')
> legend(tmp.u[1], tmp.u[4], xjust=0, yjust=0, c('a','b'), pch=1:2)
>

You will probably want to increase the margins for a real case. See ?par and the 'xpd' entry for details on the clipping and ?legend for more details on creating the legend.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow_at_imail.org
(801) 408-8111
 
 


> -----Original Message-----
> From: r-help-bounces_at_r-project.org
> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Edwin Sendjaja
> Sent: Friday, April 11, 2008 1:01 PM
> To: r-help_at_r-project.org
> Subject: [R] Legend position outside
>
> Hello,
>
> Is it possible to get the legend box outside the graphic?
>
>
> Kind regards,
>
> Edwin
>
> ______________________________________________
> 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.
>
______________________________________________ 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 Fri 11 Apr 2008 - 18:23:08 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 Sat 12 Apr 2008 - 03: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