[R] Create a plot legend in a new window

Henrik Andersson h.andersson at nioo.knaw.nl
Thu Dec 9 13:29:15 CET 2004


par(xpd=NA) will allow you to click outside your figure and create the 
legend there:

Short example:
par(mfrow=c(1,2),xpd=NA)
plot(1:5)
legend(locator(1),pch=1,legend="TEST")


Good luck, Henrik

michael watson (IAH-C) wrote:
> Hi
> 
> I have a complicated plot which has a potentially large legend.  What I
> want to do is actually create the legend in a new window.  Has anyone
> done this before?  I'd like to be able to create a window with just the
> legend in it, and have it so the window is just the right size etc.  I'm
> sure someone must have done this already?  If not, any tips would be
> welcome.
> 
> Thanks
> Mick
> 
> ______________________________________________
> R-help at 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
> 


-- 
---------------------------------------------
Henrik Andersson
Netherlands Institute of Ecology -
Centre for Estuarine and Marine Ecology
P.O. Box 140
4400 AC Yerseke
Phone: +31 113 577473
h.andersson at nioo.knaw.nl
http://www.nioo.knaw.nl/ppages/handersson




More information about the R-help mailing list