The plot does not "fail" - the way you've constructed it makes it
impossible to see the result of the last call because the fill color
of points is the same in all three calls. Here's a modified version of
your code; the line is removed to better see what is going on. The
point shape is also changed to unfilled to show that the last call
indeed works.
ggplot(aData, aes(x = C, y = D, colour = A)) +
geom_point(size = 4, shape = 21)
last_plot() + geom_point(size = 10, shape = 21)
last_plot() + geom_point(size = 2, shape = 21)
As for your original plot, one suggestion is to change to an unfilled
point shape (21-25) as follows:
overlapPlot <- ggplot(aData, aes(x = C, y = D, colour = A, shape = B)) +
geom_line(size = 2) + geom_point(size = 3) +
scale_shape_manual(values = c(21, 22))
last_plot() + geom_point(size = 10)
last_plot() + geom_point(size = 1)
ggplot2 is based on grid graphics, and grid operates on the "painter's
model" - to quote Paul Murrell in Chapter 5 of R Graphics, 2e:
"Like the traditional system, all grid output occurs on the current
device, and later output obscures any earlier output that it overlaps
(i.e.,output follows the “painters model”)."
Dennis