In ggplot2, transparency that is defined in geom_XXX is reflected in the legend. For example:
df <- data.frame(x=runif(10000), z=ifelse(runif(10000) > 0.5, 'a', 'b')); df$y <- runif(10000); df$y[df$z == 'b'] <- cos(df$x[df$z == 'b']*10)
ggplot(df) + geom_point(aes(x, y, color=z), alpha=0.1)
Gives the following result:
Since the points are very transparent, they are hardly seen on the legend. I would like to remove point transparency from the legend, so that the graph looks like this:
How is this possible?