I would like to a legend to a ggplot2 plot. The legend should identify the plotting symbol with the data. For example, data1 is plotted with a filled square and data2 is plotted with a filled circle.
Is there a way to do this?
The example below from a previous stackoverflow question worked where one adds a math (perp.) symbol.
p <- p + annotate("text",2005,5, label="E(y)*symbol('\\136')*b", parse=TRUE)
Maybe this example helps:
Here's the plot:
The values 21 and 22 refer to filled circle and filled square, respectively. See
?points
for the complete list of available symbols.