[R] after setting auto.key=TRUE, legend become inconsistent with the graph

From: Mark Farnell <mark.farnell_at_gmail.com>
Date: Tue, 24 Jun 2008 15:35:21 +1200

When I use xyplot (from package lattice) to produce a multi-series graph:

xyplot(linear+quadratic+sqrt~x, data=df, main="complexity of different functions", ylab="y", col=c("red", "black", "orange"), type="b", lty=c(1,2,3), pch=c(1,2,3), auto.key=TRUE)

where I changed the default colour, line type and data point type so that each series is distinguishable from each other. The graph looks good except that the color and shape of data point of each series in the legend still reflects the default setting of xyplot rather than what I've said in the command! This renders the legend useless. So what legend command (other than auto=TRUE) should I use instead to solve this problem?

Also currently the legend is above the graph and below the title, which looks weird to me and I want the legend to be placed at the right of the graph instead. What should I do?



R-help_at_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. Received on Tue 24 Jun 2008 - 03:41:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 24 Jun 2008 - 05:30:51 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive