Plot a distribution as a hybrid containing a halfeye, a boxplot and jittered points.
plot_dist(
dat,
yvar,
xvar = NULL,
ylim = NULL,
xlb = "",
ylb = "",
identity_line = FALSE,
identity_value = 0,
he_adjust = 0.5,
he_width = 0.6,
he_justification = -0.2,
he_col = "black",
he_fill = "#F8766D",
he_alpha = 0.9,
he_slab_type = "pdf",
he_breaks = "Sturges",
he_outline_bars = FALSE,
he_point_interval = "median_qi",
he_point_alpha = 0.9,
he_point_fill = "#F8766D",
he_point_colour = "#F8766D",
he_point_size = 2,
bxp_width = 0.12,
bxp_outlier_col = NA,
bxp_outlier_fill = NA,
bxp_outlier_shape = 19,
bxp_outlier_size = 1.5,
bxp_col = "black",
bxp_fill = "#F8766D",
bxp_alpha = 0.9,
bxp_notch = FALSE,
bxp_notchwidth = 0.5,
hp_alpha = 0.25,
hp_col = "#F8766D",
hp_size = 1,
hp_shape = 16,
na.rm = FALSE
)
A plot containing jittered points, a boxplot and a density plot or histogram illustrating the distribution of every group of the data under evaluation.
A data frame.
The name of the field containing values to be plotted.
The name of the field containing the grouping variable (defaults to NULL
).
Limits for the y-axis. Defaults to NULL
. If provided, should be a 2-element vector containing the upper and lower limits.
Label for the x-axis.
Label for the y-axis.
Show a line of identity? Default FALSE
.
If an identity line is shown, it will be drawn horizontally at this y-value (default 0).
If he_slab_type
is "pdf"
, bandwidth for the density estimator is adjusted by multiplying it by this value.
Width of the halfeye component of the plot (default 0.6).
Justification of the halfeye component of the plot (default -0.2).
Color for the halfeye component of the plot.
Fill color for the halfeye component of the plot.
Alpha for the halfeye component of the plot (default 0.9).
The type of slab function to calculate for the halfeye component of the plot: probability density (or mass) function ("pdf"
, the default), cumulative distribution function ("cdf"
), complementary CDF ("ccdf"
) or histogram ("histogram"
).
If slab_type is "histogram"
, the breaks parameter that is passed to hist()
to determine where to put breaks in the histogram.
If slab_type is "histogram"
, determines if outlines in between the bars are drawn when the slab_color aesthetic is used. If FALSE
(the default), the outline is drawn only along the tops of the bars; if TRUE
, outlines in between bars are also drawn.
A function from the ggdist::point_interval
family (e.g., median_qi
, mean_qi
, mode_hdi
, etc), or a string giving the name of a function from that family (e.g., "median_qi"
, "mean_qi"
, "mode_hdi"
, etc. This function determines the point summary (typically mean, median, or mode) and interval type (quantile interval, qi
; highest-density interval, hdi
; or highest-density continuous interval, hdci
). Output will be converted to the appropriate x- or y-based aesthetics depending on the value of orientation.
Alpha for the point.
Fill colour for the point.
Colour for the point.
Size for the point.
Width of the boxplot component (default 0.12).
Color for outliers in the boxplot component.
Fill color for outliers in the boxplot component.
Shape for outliers in the boxplot component.
Size for outliers in the boxplot component.
Color for the boxplot component.
Fill color for the boxplot component.
Alpha for the boxplot component.
If FALSE
(default) make a standard box plot. If TRUE
, make a notched box plot. Notches are used to compare groups; if the notches of two boxes do not overlap, this suggests that the medians are significantly different.
For a notched box plot, width of the notch relative to the body (default 0.5).
Alpha for the jitter.
Color for the jitter.
Size for the jitter.
Shape for the jitter.
If FALSE
, the default, missing values are removed with a warning. If TRUE
, missing values are silently removed.
Justin Wilkins, justin.wilkins@occams.com
if (FALSE) {
plot_dist(dat, "ETA1", identity_line = T, he_slab_type = "histogram", he_breaks = 30)
}
Run the code above in your browser using DataLab