[R] how to make auto.key to produce a legend that uses line pattern (rather than data point) as labels?

Markus Gesmann Markus.Gesmann at libero.uk.com
Wed Jun 25 10:36:43 CEST 2008

Hi Mark,

# With auto.key you can specify in a list what kind of graphical output you would like to see in your legend, e.g.

 mydata <- data.frame(x=1:4,y=1:4, g=c("a","a","b","b"))
 xyplot(y~x, groups=g, data=mydata,
                                t="l", auto.key=list(lines=TRUE, points=FALSE))

# See as well the documentation for auto.key and key under ?xyplot

# As an alternative you might want to use simpleKey
 xyplot(y~x, groups=g,data=mydata, t="l",
        key=simpleKey(text=levels(mydata$g),lines=TRUE, points=FALSE))



Markus Gesmann │Associate Director│Libero Ventures Ltd, One Broadgate, London EC2M 2QS
tel: +44 (0)207 826 9080│ dir: +44 (0)207 826 9085│fax: +44 (0)207 826 9090 │www.libero.uk.com

A Lehman Brothers Company


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Mark Farnell
Sent: 24 June 2008 23:46
To: r-help at r-project.org
Subject: [R] how to make auto.key to produce a legend that uses line pattern (rather than data point) as labels?


I am working on a line graph under xyplot.  what command should I feed
to auto.key so that it uses the line pattern of series as labels?

Also where can I find doc about all options that I can feed to auto.key?



R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

This message is intended for the personal and confidential use for the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination,  distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction or as an official statement of Libero Ventures Ltd.  Email transmissions cannot be guaranteed to be secure or error-free. Therefore we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.

More information about the R-help mailing list