[R] lattice key (legend) with both points and lines

Peter McMahan peter.mcmahan at gmail.com
Tue Mar 20 23:16:11 CET 2007


Hello,
I'm running into a frustrating problem with the legend on a lattice  
plot I'm working with. The plot is a stripplot with a panel.linejoin 
() line running through the mean of each of the categories. Thus  
there are both points and lines in the plot.
In trying to make a key for the plot, I can't figure out how to make  
a legend for both the points and the lines. What I'd like is  
something like:

prices    *
means   -----

in which there are two "rows" in the legend, one with the point and  
its label and one with the line and its label. By supplying this type  
of argument to stripplot:

key=list(text=list(lab="prices"),
          points=list(...),
          text=list(lab="means"),
          lines=list(...))

I can get a legend that looks like:

prices    *     means   -----

But this looks awkward with my plot

Is there any way to have the plot elements and their labels be in the  
same column?

Thanks,
Peter



More information about the R-help mailing list