[R] Plotting Multiple Factors By Dates With Lattice
Rich Shepard
rshepard at appl-ecosys.com
Fri Aug 16 18:01:16 CEST 2013
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
More information about the R-help
mailing list