geom_love {tidysmd} | R Documentation |
Create a Love plot
Description
geom_love()
and love_plot()
are helper functions to create Love plots in
ggplot2. Love plots are a diagnostic approach to assessing balance before and
after weighting. Many researchers use 0.1 on the absolute SMD scale to
evaluate if a variable is well-balanced between groups, although this is just
a rule of thumb. geom_love()
is a simple wrapper around
ggplot2::geom_point()
, ggplot2::geom_line()
, and
ggplot2::geom_vline()
. It also adds default aesthetics via
ggplot2::aes()
. love_plot()
is a quick plotting function that further
wraps geom_love()
. For more complex Love plots, we recommend using ggplot2
directly.
Usage
geom_love(
linewidth = 0.8,
line_size = NULL,
point_size = 1.85,
vline_xintercept = 0.1,
vline_color = "grey70",
vlinewidth = 0.6,
vline_size = NULL
)
love_plot(
.df,
linewidth = 0.8,
line_size = NULL,
point_size = 1.85,
vline_xintercept = 0.1,
vline_color = "grey70",
vlinewidth = 0.6,
vline_size = NULL
)
Arguments
linewidth |
The line size, passed to |
line_size |
Deprecated. Please use |
point_size |
The point size, passed to |
vline_xintercept |
The X intercept, passed to |
vline_color |
The vertical line color, passed to
|
vlinewidth |
The vertical line size, passed to
|
vline_size |
Deprecated. Please use |
.df |
a data frame produced by |
Value
a list of geoms
or a ggplot
Examples
plot_df <- tidy_smd(
nhefs_weights,
race:active,
.group = qsmk,
.wts = starts_with("w_")
)
love_plot(plot_df)
# or use ggplot2 directly
library(ggplot2)
ggplot(
plot_df,
aes(
x = abs(smd),
y = variable,
group = method,
color = method,
fill = method
)
) +
geom_love()