View source: R/gt_plt_bullet.R
gt_plt_bullet | R Documentation |
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
)
gt_object |
An existing gt table object of class |
column |
The column where a 'bullet chart' will replace the inline values. |
target |
The column indicating the target values that will be represented by a vertical line |
width |
Width of the plot in pixels |
palette |
Color of the bar and target line, defaults to |
palette_col |
An additional column that contains specific colors for the bar colors themselves. Defaults to NULL which skips this argument. |
An object of class gt_tbl
.
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.