I am having trouble getting geom_rug to plot some data into an existing plot. Here\'s an example plot, where I am comparing some visit day to the magnitude of some measureme
I would try either this:
ggplot(test, aes(x = visit, y = mag)) + geom_point() +
geom_rug(data=vac, aes(x = visit,y = NULL))
or perhaps a better option this:
ggplot() +
geom_point(data = test,aes(x = visit,y = mag)) +
geom_rug(data=vac, aes(x = visit))
You should specify inherit.aes = FALSE
in the geom_rug()
line, otherwise it inherits y = mag
from the main ggplot()
call.
ggplot(test, aes(x = visit, y = mag)) +
geom_point() +
geom_rug(data=vac, aes(x = visit), inherit.aes = F)