Make boxplots
Arguments
- df
data frame to plot
- x
character name for x-axis data
- y
character name for y-axis data
- xs
see
defcx- ys
see
defy- fill
passed to
ggplot2::geom_boxplot(). SpecifyingNULLdisables relaying the value togeom_boxplotand is required for modifying the fill of the returned plot withggplot2::aes().- alpha
passed to
geom_boxplot- hline
used to draw horizontal reference line
- title
passed to
ggtitle- shown
if
TRUEprovide a numeric summary of each box (see details)- points
show points in back of transparent boxes; if
TRUE, a default display of points is made on top of boxes; also may be passed as a list of arguments to pass togeom_point; see details- outlier.shape
passed to
geom_boxplot- ...
arguments passed to
geom_boxplot
Details
Since this function creates a boxplot,
the x column must be character, factor
or logical and y column must
be numeric.
If shown is TRUE, a numeric summary of each
box is included
below each box. In the summary, n is the number of
non-NA observations in the y column for that box and
N is the number of unique ID values for
that box. An error will be generated if ID does
not exist in the plotting data frame when shown is
TRUE. When N is equal to n in the
summary, only n is shown.
The summaries will not be correct if the plot is eventually faceted by
another variable in the data set. In this case, either use
shown=FALSE or create the plot with split_plot.
When the user passes the points argument, outlier.shape is
automatically switched to NA so that outlier points are only plotted
once. The fill argument is also set to NA, so that boxes become
transparent, showing the points.
When the user sets points to TRUE, grey points are shown
in back of transparent boxes and the points are jittered in the x-direction.
The user can customize the display of the points by passing a list of
arguments for geom_point (for example, change the color, transparency,
size, jitter amount, etc). The user can also pass jitter_width in
the points list to set the amount of jitter in the x-direction while
keeping jitter in the y-direction zero. Passing jitter_width will
override any other value passed under position in the points
list.
