Closed rizqrama closed 2 years ago
Thanks for reporting! There was an error in the package (selecting a 3rd color when there are only 2). I'll push an update shortly, but am adding a test to protect against this as well.
For your issues, here's a quick reprex
:
library(gtExtras)
library(gt)
packageVersion("gtExtras")
#> [1] '0.2.19'
generate_df(
n = 2, n_grps = 10, mean = rep(400000, 10)
) %>%
dplyr::group_by(grp) %>%
dplyr::summarize(data = list(values)) %>%
gt() %>%
gt_plt_bar_stack(data, palette = c("black", "orange"),
labels = c("Grp 1", "Grp 2")) %>%
gtsave("test.png")
Created on 2021-10-15 by the reprex package (v2.0.1)
For your issues, here's a quick
reprex
:library(gtExtras) library(gt) packageVersion("gtExtras") #> [1] '0.2.19' generate_df( n = 2, n_grps = 10, mean = rep(400000, 10) ) %>% dplyr::group_by(grp) %>% dplyr::summarize(data = list(values)) %>% gt() %>% gt_plt_bar_stack(data, palette = c("black", "orange"), labels = c("Grp 1", "Grp 2")) %>% gtsave("test.png")
Created on 2021-10-15 by the reprex package (v2.0.1)
Thank you very much for your explanation!
Hi! I tried to make a stacked barchart as a part of gt table. However, when I run the code, the table didn't visualize/produce the bar of the second group.
Here's a little bit detail of my data
and this is the code I wrote
However, this is the result I got:
and this is what I have tried:
unfortunately, none of those work.
Thank you for hearing me out! Love to use gtExtras for my further research