Using pch I can plot any symbol and assign any label to in the legend. But how can I plot two symbols for each legend label? For example, in the plot below, I would like to have ■ ▲ ● paired with red versions of those so I have only three labels ‘a’, ‘b’, ‘c’ displayed in the legend, for those six symbols. At the moment, it seems that basic plot legend allows me to only plot one symbol for each label:
plot(rnorm(50),pch=c(15:17),col=1:2)
legend('topleft',pch=c(15:17),col=1:2,legend=c("a","b","c"),cex=1.5)

This isn’t too hard with
lattice, as itskey =argument takes an arbitrary number of columns to be included in the legend.I don’t know off the top of my head how to include the legend inside the plotting area, but with this kind of plot it seems better to have it outside anyway. (Edit: @chl in comments kindly points out a couple of ways to do this. To plot the key in the lower-left of the figure, for instance, replace
space = "right"in the above with eithercorner = c(0,0)orx = 0, y=0.2)