The solid=FALSE argument to scale_shape_discrete does not do what you
think it does; it selects solid shapes (ones that have the same middle
color as they are drawn in) rather than fillable shapes (ones which can
have a different fill color than line color.
For a catalog of all the shapes and the effects of color and fill on
them, try:
DF <- data.frame(pt = 0:25, x = 1, y = 1)
ggplot(DF, aes(x=x, y=y, shape=pt)) +
geom_point(colour="red", fill="lightblue", size=10) +
scale_shape_identity() +
facet_wrap(~pt) +
theme_bw() +
theme(axis.text = element_blank(),
axis.title = element_blank(),
axis.ticks = element_blank())
Requesting solid shapes (the default) gives 16, 17, 15, 3, 7, and 8.
Requesting not solid shapes gives 1, 2, 0, 3, 7, 8. Neither set includes
the fillable ones (21-25), so you have to specify them using a manual
scale as you do in your second example.
The problem with the legend in the second example is that the shape of
the points in the legend is, by default, 16. But fill does not have an
effect of shape 16, so the legend is all black circles. Shape 21 is a
better choice and that can be specified with
ggplot(mtcars, aes(x=wt, y=mpg)) +
geom_point(aes(shape=factor(vs), fill=factor(am)), size=4) +
scale_shape_manual(values=c(21, 23)) +
scale_fill_discrete(guide = guide_legend(override.aes = aes(shape = 21)))
--
Brian S. Diggs, PhD
Senior Research Associate, Department of Surgery
Oregon Health & Science University