butterfly_plot: butterfly_plot

butterfly_plotR Documentation

butterfly_plot

Description

This function creates a butterfly plot commonly used to show propensity score overlap

Usage

butterfly_plot(
  x,
  y,
  col1 = "#FF000060",
  col2 = "#3200D360",
  border1 = "black",
  border2 = "black",
  breaks = 100,
  label = T,
  legend = F,
  legendloc = "bottomleft",
  flipaxis = F,
  psrange = NULL
)

Arguments

x

a vector of values for which the histogram is desired

y

a vector of values for which groups are defined

col1

character, color of histogram for group 1, default is #FF000060

col2

character, color of histogram for group 2, default is #3200D360

border1

character, color of histogram border of group 1, default is black

border2

character, color of histogram border of group 2, default is black

breaks

a single number giving the number of cells for the histogram, default is 100

label

logical, whether to add group labels above histograms, default is TRUE

legend

logical, whether to add legend, default is FALSE

legendloc

location location specified by setting to a single keyword from the list "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center". Default is "bottomleft."

flipaxis

logical, direction of the butterfly. FALSE is butterfly shape i.e. reflected over y-axis, TRUE is reflected over x-axis. Default is TRUE.

psrange

range of histogram values

Examples

butterfly(x = data$ps, data$group, label = F, flipaxis = T)
butterfly(x = data$ps, data$group, label = F, flipaxis = F, breaks = 10)

olsonma/mollr documentation built on Aug. 2, 2022, 9:17 p.m.