In ggplot2, geom_point defaults to plotting over the current plot. For example, calling geom_point after a call to geom_boxplot results in the points plotted over the boxplot:
ggplot(iris, aes(x = "All", y = Sepal.Length)) +
geom_boxplot() +
geom_point(aes(color=Species), position = "jitter")
Is there a way to plot the points separately to the side, rather than over the boxplot?
In my particular case I want to do this because the points obscure the plot (even with transparency, etc), a problem that is not an issue with the example dataset here.
You can plot them separately by supplying separate x-values for the boxplot and the points:
Another option is to use boxplots by species:
Here's what the two plots look like: