addggLayers | R Documentation |
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
)
g |
a |
data |
data frame/table containing raw data |
type |
specifies either extended box plot or spike histogram. Both are horizontal so are showing the distribution of the x-axis variable. |
ylim |
y-axis limits to use for scaling the height of the added plots, if you don't want to use the limits that |
by |
the name of a variable in |
value |
name of x-variable |
frac |
fraction of y-axis range to devote to vertical aspect of the added plot |
mult |
fudge factor for scaling y aspect |
facet |
optional faceting variable |
pos |
position for added plot |
showN |
sete to |
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.
the original ggplot
object with more layers added
Frank Harrell
spikecomp()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.