[R] Lattice xyplot: Line and Rectangle in legend.

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed Apr 15 02:14:22 CEST 2009


On Tue, Apr 14, 2009 at 4:39 PM, jimdare <jamesdare26 at gmail.com> wrote:
>
> Hello fellow R users,
>
> I have a problem.  I have created a barchart overlayed by an xyplot line,
> both of which read off the same Y axis.  The problem comes when I try to
> generate a key.  It seems that I can only create either two lines, or two
> rectangles.  I would much prefer to have the barchat series depicted by a
> rectangle, and the xyplot series by a line.  Is there a way to do this?

Something like

xyplot(1 ~ 1, key = list(text = list("line"), lines = list(col = 2),
text = list("rect"), rect = list(col = "yellow")))

?

-Deepayan




More information about the R-help mailing list