I'm finding the combined legend for shape and linetype to be difficult to decipher. specifically, the shape is hard to see because it is behind the line and it is too small.
library(ggplot2)
ggplot(mtcars)+
geom_point(aes(x=hp,y=mpg,shape=as.factor(cyl)))+
geom_smooth(aes(x=hp,y=mpg,linetype=as.factor(cyl)),method='lm')+
theme_bw(base_size=18)
How do I increase the size of the shapes in the legend without increasing the size of the line?
this attempt below increases the size for both (not what I want). the order of the guide_legend
also does not seem to affect the order of the symbols in the legend keys. Changing the order of the geom_point and geom_smooth would give the desired result in the legend but not in the plot.
+guides(linetype=guide_legend('Cylinders'),shape=guide_legend('Cylinders',override.aes=list(size=3)))
I was also hoping theme(legend.key.size=grid::unit(2,'cm'))
would scale up the size of the objects in the legend key but it doesn't appear to do so.
suggestions? also open to other ideas how to make the graph more legible.