Closed jmbarbone closed 2 years ago
Fixed in dev-version, thanks for heads up. The underlying label had a background fill which I removed. Note there are two ways of removing the text, either one works:
Set text to zero
text_size = 0
Change text to transparent
palette = c("red", "lightgrey", "black", "transparent")
library(gt)
library(gtExtras)
ci_table <- generate_df(
n = 50, n_grps = 3,
mean = c(10, 15, 20), sd = c(10, 10, 10),
with_seed = 37
) %>%
dplyr::group_by(grp) %>%
dplyr::summarise(
n = dplyr::n(),
avg = mean(values),
sd = sd(values),
list_data = list(values)
) %>%
gt::gt() %>%
gt_plt_conf_int(list_data, ci = 0.9)
# You can also provide your own values
# based on your own algorithm/calculations
pre_calc_ci_tab <- dplyr::tibble(
mean = c(12, 10), ci1 = c(8, 5), ci2 = c(16, 15),
ci_plot = c(12, 10)
) %>%
gt::gt()
pre_calc_ci_tab1 <- pre_calc_ci_tab %>%
gt_plt_conf_int(
ci_plot, c(ci1, ci2),
# can use text size = 0
text_size = 0,
# can use palette = c("red", "lightgrey", "black", "transparent")
palette = c("red", "lightgrey", "black", "red")
) %>%
gt_theme_dark()
gtsave_extra(pre_calc_ci_tab1, "tab1.png", selector = "table")
knitr::include_graphics("tab1.png")
pre_calc_ci_tab2 <- pre_calc_ci_tab %>%
gt_plt_conf_int(
ci_plot, c(ci1, ci2),
# can use text size = 0 or
# can use palette = c("red", "lightgrey", "black", "transparent")
palette = c("red", "lightgrey", "black", "transparent")
) %>%
gt_theme_dark()
gtsave_extra(pre_calc_ci_tab2, "tab2.png", selector = "table")
knitr::include_graphics("tab2.png")
Created on 2022-06-15 by the reprex package (v2.0.1)
When
textsize = 0
there is still something plotted -- and this leaves a white background that is visible with a darker row color. Whentextsize <= 0
can the steps for plotting text inadd_ci_plot()
just be skipped to avoid this?Created on 2022-06-15 by the reprex package (v2.0.1)