Customized geom

mc_obs_custom(plot, ...)

mc_model_custom(plot, ..., n_sample = NA, group_sample = "collapse")

Arguments

plot

The plot to use. It should be a geom function like geoms in ggplots and should be able to have data and mapping augments. See examples for more details.

...

Augments passed to plot.

n_sample

The number of sample of draws to show. Default NA. If n_sample is NA, then mc_model_custom() will use all draws from posterior distribution.

group_sample

How to show draws? Default "hops". If group_sample is "collapse", then all draws are collapsed together and are shown in one geom; if "draw" is "group", then only one draw is shown in one geom; if group_sample is "hops", then mc_model_custom() will use animation to show each draw in one frame; if group_sample is an function, then all draws are aggregated by group_sample(). See examples for more details.

Examples

library(ggplot2)
library(ggdist)

mcplot(mpg_model) +
  mc_model_custom(stat_boxplot, notch = TRUE) +
  mc_obs_custom(geom_swarm) +
  mc_condition_on(x = vars(vs)) +
  mc_gglayer(coord_flip())