Create an inline 'bullet chart' in a gt table
gt_plt_bullet(
gt_object,
column = NULL,
target = NULL,
width = 65,
palette = c("grey", "red"),
palette_col = NULL
)
An object of class gt_tbl
.
An existing gt table object of class gt_tbl
The column where a 'bullet chart' will replace the inline values.
The column indicating the target values that will be represented by a vertical line
Width of the plot in pixels
Color of the bar and target line, defaults to c("grey", "red")
, can use named colors or hex colors. Must be of length two, and the first color will always be used as the bar color.
An additional column that contains specific colors for the bar colors themselves. Defaults to NULL which skips this argument.
set.seed(37)
bullet_tab <- tibble::rownames_to_column(mtcars) %>%
dplyr::select(rowname, cyl:drat, mpg) %>%
dplyr::group_by(cyl) %>%
dplyr::mutate(target_col = mean(mpg)) %>%
dplyr::slice_sample(n = 3) %>%
dplyr::ungroup() %>%
gt::gt() %>%
gt_plt_bullet(column = mpg, target = target_col, width = 45,
palette = c("lightblue", "black")) %>%
gt_theme_538()
3-7
Other Themes:
gt_plt_conf_int()
,
gt_plt_dot()
,
gt_theme_538()
,
gt_theme_dark()
,
gt_theme_dot_matrix()
,
gt_theme_espn()
,
gt_theme_excel()
,
gt_theme_guardian()
,
gt_theme_nytimes()
,
gt_theme_pff()