butterfly_plot | R Documentation |
This function creates a butterfly plot commonly used to show propensity score overlap
butterfly_plot( x, y, col1 = "#FF000060", col2 = "#3200D360", border1 = "black", border2 = "black", breaks = 100, label = T, legend = F, legendloc = "bottomleft", flipaxis = F, psrange = NULL )
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 |
butterfly(x = data$ps, data$group, label = F, flipaxis = T) butterfly(x = data$ps, data$group, label = F, flipaxis = F, breaks = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.