Boxplots (ggplot)


diamonds is a dataset that ships with ggplot2 with observations from almost 54,000 diamonds.  Data slicing is possible by price, carat, cut, color, clarity, size, depth and table width. Boxplots are ideally suited for visualizing data variability.

Basic Boxplot Syntax


Boxplot Aesthetics

Boxplot aesthetics define the x input data and have several argument parameters that control box attributes: ymin,lower quartile,  middle bar statistic, upper quartile, and ymax.  Additional arguments include color, fill, linetype, shape, size, weight and alpha transparency level.


Example: Fully Loaded

The default probabilities for any box plot are the standard quantiles.  Custom probabilities can be plotted using predefined data inputs and the results displayed using geom_text. Note that no outliers are plotted with ymin = 0 and ymax = 1.


Back | Next