Add Spike Histograms and Extended Box Plots to ggplot
addggLayers(
g,
data,
type = c("ebp", "spike"),
ylim = layer_scales(g)$y$get_limits(),
by = "variable",
value = "value",
frac = 0.065,
mult = 1,
facet = NULL,
pos = c("bottom", "top"),
showN = TRUE
)
the original ggplot
object with more layers added
a ggplot
object
data frame/table containing raw data
specifies either extended box plot or spike histogram. Both are horizontal so are showing the distribution of the x-axis variable.
y-axis limits to use for scaling the height of the added plots, if you don't want to use the limits that ggplot
has stored
the name of a variable in data
used to stratify raw data
name of x-variable
fraction of y-axis range to devote to vertical aspect of the added plot
fudge factor for scaling y aspect
optional faceting variable
position for added plot
sete to FALSE
to not show sample sizes
Frank Harrell
For an example see this. Note that it was not possible to just create the layers needed to be added, as creating these particular layers in isolation resulted in a ggplot
error.
spikecomp()