Hi

If you cannot get anything right in base graphics 
You could plot the graph and then use 
library(grid)
viewport(....)
etc
for each of the legends

or even lattice and grid

xyplot(...,
              legend =  list( ....),
)

see https://stat.ethz.ch/pipermail/r-help/2005-April/069459.html

for one way with grid package,  other ways may be using lattice and
lattice::draw.key

I' m a bit rusty on the actual workings

Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au


-----Original Message-----
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Rainer M
Krug
Sent: Saturday, 12 March 2016 01:02
To: r-help@r-project.org
Subject: [R] specify size of box around legend

Hi

assume the following code:

--8<---------------cut here---------------start------------->8---
plot(1,1)
legend(x="topleft", legend = LETTERS[1:10], title = "L 1")
legend(x="bottomleft", legend = paste(LETTERS[1:10],
letters[1:12],LETTERS[1:10]), title = "L 2")
legend(x="topright", legend = LETTERS[1:15], title = "L 3")
--8<---------------cut here---------------end--------------->8---

The box around L 1 is less wide than the box around L 2 due to automatic
sizing of the box.

Is there a way of specifying the width of the box, so that L 1 and L 2
have the same width?

In the same sense: can I also specify the height of the legend, so that
L 1 and L 3 have the same height?

Thanks,

Rainer
-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

______________________________________________
R-help@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.

Reply via email to