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

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue Jun 24 07:00:02 CEST 2008


On 6/23/08, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> Set the various plotting parameters in par.settings= in which
>  case both the legend and the plot itself will be taken from there.
>  See for example:
>
>  http://finzi.psych.upenn.edu/R/Rhelp02a/archive/90432.html
>
>  where superpose.line parameters are set.  Similarly you can
>  set superpose.symbol parameters.

Also check out ?simpleTheme for a shortcut. The example there also
shows you how to place the legend on the right.

-Deepayan

>  On Mon, Jun 23, 2008 at 11:35 PM, Mark Farnell <mark.farnell at gmail.com> wrote:
>  > 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?
>  >
>  > Thanks!
>  >
>  > Mark
>  >
>  > ______________________________________________
>  > 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.
>  >
>
>  ______________________________________________
>  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.
>



More information about the R-help mailing list