Skip to content
Prev 310579 / 398506 Next

Two-line title in R legend

The top line is not outside the box in this example, but the bottom text
line is too close to the bottom. You can turn off drawing the box in
legend(). Store the return value of legend() which indicates where the box
would have been drawn and use rect() to add it after increasing the
dimension you need. In the example I lowered the bottom of the box by .1:
+  bty="n")
$rect
$rect$w
[1] 2.558594

$rect$h
[1] 0.6723839

$rect$left
[1] 0.5

$rect$top
[1] 3


$text
$text$x
[1] 1.0625

$text$y
[1] 2.578779
----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352