You can cut a continuous variable in several sections, and plot a box for each section.
Here we take the value of “carat” and cut it by 0.5 step. This is done with the cut_width() function.
# The mtcars dataset is proposed in R
ggplot(diamonds, aes(x=carat, y=price)) +
geom_boxplot(fill="skyblue", aes(group = cut_width(carat, 0.5)))
Not what you are looking for ? Make a new search !