addggLayers: addggLayers

View source: R/addggLayers.r

addggLayersR Documentation

addggLayers

Description

Add Spike Histograms and Extended Box Plots to ggplot

Usage

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
)

Arguments

g

a ggplot object

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 ggplot has stored

by

the name of a variable in data used to stratify raw data

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 FALSE to not show sample sizes

Details

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.

Value

the original ggplot object with more layers added

Author(s)

Frank Harrell

See Also

spikecomp()


harrelfe/Hmisc documentation built on April 18, 2024, 11:06 p.m.