[R] Creating a flat legend 'grob' for lattice xyplot

Mark Mark.Oberfield at noaa.gov
Wed Jul 27 19:31:43 CEST 2011


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)
legend(0.15,-0.125,
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?'))

Thanks!



--
View this message in context: http://r.789695.n4.nabble.com/Creating-a-flat-legend-grob-for-lattice-xyplot-tp3699235p3699235.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list