Add a dumbbell plot in place of two columns
gt_plt_dumbbell(
gt_object,
col1 = NULL,
col2 = NULL,
label = NULL,
palette = c("#378E38", "#A926B6", "#D3D3D3"),
width = 70,
text_args = list(accuracy = 1),
text_size = 2.5
)
a gt_object table
an existing gt_tbl or pipeline
column 1, plot will replace this column
column 2, will be hidden
an optional new label for the transformed column
must be 3 colors in order of col1, col2, bar color
width in mm, defaults to 70
A list of named arguments. Optional text arguments passed as a list to scales::label_number
.
A number indicating the size of the text indicators in the plot. Defaults to 1.5. Can also be set to 0
to "remove" the text itself.
head(mtcars) %>%
gt() %>%
gt_plt_dumbbell(disp, mpg)