hist_boxplot2 | R Documentation |
Creates a histogram and jittered boxplot with color-coded, separate distributions for each value of a user-specified categorical variable.
hist_boxplot2( data, binsize = diff(range(data[, 1], na.rm = T))/25, colors = NULL, hist_alpha = 0.75, box_fill = "gray50", box_alpha = 0.5, box_lwd = 1, jitter_alpha = 0.75, jitter_size = 1.75, x_title = "", y_title = "" )
data |
A two-column data frame with numeric values for plotting in the first column and the categorical variable as the second column. |
binsize |
A numeric value for the histogram bin widths. |
colors |
A string vector. The histogram bar colors and jitter colors for each categorical variable value. |
hist_alpha |
A numeric value for the alpha level for histogram bars. |
box_fill |
A string. The fill color for the boxplot. |
box_alpha |
A numeric value for the alpha level for the boxplot. |
box_lwd |
A numeric value for the boxplot line width. |
jitter_alpha |
A numeric for the alpha level for jittered data points. |
jitter_size |
A numeric for the point size for jittered data points. |
x_title |
A string denoting the x-axis title. Only added to the boxplot. |
y_title |
A string denoting the y-axis title. Only added to the histogram. |
Creates two plots that can be organized as a single column two row multi-figure. The top row plot is multiple overlayed histograms from data partitioned by a variable. The bottom row plot is multiple horizontal boxplots with jittered data points overlayed. The x-axis of both plots are fixed to the same limits for comparability across plots.
A list of two ggplot objects hist
and boxplot
.
hist_boxplot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.