Boxplots without boxes
Let's say you have several categories with multiple data points each that you would like to plot as individual points. Even if you have only a single point, the R graphics package
will plot a line (without a box for lack of data). Overriding the default setting with e.g. pch = 1 does not help.
function (or the
function for that matter) - correctly - generates a boxplot for each category. If you would like to see individual points instead of boxes, the following code snippet could help by using the
# Plot the boxplot as usual, but in white colour to make the boxes invisible, but keep the axes.
boxplot(m$var ~ m$cat, xlab = "Category", ylab = "Variable", border = "white")
# Plot the data again into the same plot and customise the point shape, etc to your liking
points(m$var ~ m$cat, pch = 1)
This entry was posted in r
and tagged boxplot
. Bookmark the permalink