Skip to content
Prev 359287 / 398502 Next

specify size of box around legend

Also you can specify the upper left/lower right coordinates of the legend box:

# Get the default positions/sizes
plot(1, 1)
a <- legend(x="topleft", legend = x, title = "L 1")
b <- legend(x="bottomleft", legend = y, title = "L 2")

# Use those to change the box size
plot(1, 1)
legend(x=c(a$rect$left, a$rect$left+b$rect$w), y=c(a$rect$top, 
     a$rect$top-a$rect$h), legend = x, title = "L 1")
legend(x="bottomleft", legend = y, title = "L 2")

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Jim Lemon
Sent: Saturday, March 12, 2016 9:34 PM
To: Rainer M Krug; r-help mailing list
Subject: Re: [R] specify size of box around legend

Hi Rainer,
You can use the text.width argument and override the calculated legend
text widths.

Jim
On Sat, Mar 12, 2016 at 1:01 AM, Rainer M Krug <Rainer at krugs.de> wrote:
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.