We can draw box plot as below:
qplot(factor(cyl), mpg, data = mtcars, geom = "boxplot")
and point as:
qplot(factor(cyl), mpg, data = mtcars, geom = "point")
How would you combine both – but just to show a few specific points(say when wt is less than 2) on top of the box?
Use
+ geom_point(...)on yourqplot(just add a+ geom_point()to get all the points plotted).To plot selectively just select those points that you want to plot:
If you know the points before-hand, you can feed them in directly e.g.: