On Jul 27, 2011, at 1:31 PM, Mark wrote:
Hi,
I want my xyplot legend to be flat, not tall, and there seems to be
no way
for xyplot's auto.key and key elements to do this: I tried many, many
permutations of what I could find in the archives and reading the
documentation. If there there's a way to make it flat, please tell
me what
the magic incantation is.
Here's a simple example of what I like to see. The xyplot will be a
multi-panelled one with a single,
flat legend below. It seems the xyplot's legend element is the way
to go --
the option I haven't tried because I don't know what or how to
create a grob
of this kind. Where to start?
xyplot(1~1) # a lattice function
legend(0.15,-0.125, # a base graphics function
bty='n',pch=rep(c(15,17),
2),col=c('brown','green','blue','red'),ncol=4,
legend=c('How','to make','this into', 'a grob?'))
It is possible to define a legend object inside xyplot but using the
base graphics legend() is NOT how it is done. You should provide a
sample data.frame and someone will show you how to do it. The example
in Sarkar's Lattice book that does it uses barchart and specifies
auto.key with a columns= argument. It's fig 10.2 and you can find the
examples on the website. It's also described in the key section of ?
xyplot .... I just looked.
--
David Winsemius, MD
West Hartford, CT
______________________________________________
R-help@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.