Closed daneel6672 closed 1 year ago
Howdy!
All the plots appear correct to me unless I'm missing something?
The bar charts have a vertical black line indicating zero, so left-facing bars are negative and right-facing are positive.
library(gtExtras)
#> Loading required package: gt
mtcars_test <- mtcars
mtcars_test[,"mpg"] <- -mtcars_test[,"mpg"]
mtcars_test %>%
head() %>%
dplyr::mutate(mpg = ifelse(mpg == -18.1, 18.1, mpg)) |>
gt() %>%
gt_plt_bar(column = mpg, keep_column = TRUE) |>
gtExtras::gt_reprex_image()
Created on 2023-08-27 by the reprex package (v2.0.1)
Closing for now, but let me know if I misunderstood the question.
The picture I added was what the results are supposed to look like (I edited the actual picture). When I run the reproducible example I get blank graphs if all the bars have negative values.
Hi @daneel6672 - this is what I'm seeing with the latest version of gtExtras
:
library(gtExtras)
mtcars_test <- mtcars
mtcars_test[,"mpg"] <- -mtcars_test[,"mpg"]
mtcars_test %>%
head() %>%
gt() %>%
gt_plt_bar(column = mpg, keep_column = TRUE)
I had version gtExtras_0.4.5 which generates that blank output. I used your repository and upgraded to gtExtras_0.5.0 and now I see the same output as you. Thanks for your help and for making and maintaining such a great package.
Description
gt_plt_bar() has missing bar plots when all the values in the bar plot are negative
Reproducible example
Expected result
A bar plot with all negative values (zero on the right for all of them)