On Fri, 16 Aug 2013, Richard M. Heiberger wrote:

The major problem is all the padding and the LF in the level names.
This repair is based on the ?gsub example on "## trim trailing white space".

Rich

  Thanks. I thought of removing white space (didn't notice the spurious
newline) in emacs but did not see that it made a difference. Now I know it
does I'll clean up all the files.

I switched the key to "lines" to match the graph.

  OK.

You need to control the color choice differently when using a key.
It is discussed in ?xyplot in the paragraph
         Note that 'simpleKey' uses the default settings (see
         'trellis.par.get') to determine the graphical parameters in
         the key, so the resulting legend will be meaningful only if
         the same settings are used in the plot as well.  The
         'par.settings' argument may be useful to temporarily modify
         the default settings for this purpose.

  I'll carefully read it.

xyplot(pct ~ sampdate, data = bdf, groups = func_feed_grp, type = 'l',
      key = simpleKey(text = levels(bdf$func_feed_grp), space ='right',
points=FALSE, lines=TRUE),
      par.settings=list(superpose.points=list(col=rainbow(7)),
superpose.lines=list(col=rainbow(7))))

  Valuable lessons learned here. Again, thanks.

Rich

______________________________________________
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.

Reply via email to