jthomasmock / gtExtras

A Collection of Helper Functions for the gt Package.
https://jthomasmock.github.io/gtExtras/
Other
195 stars 27 forks source link

Target doesn't appear in `gt_plt_bullet` if it's higher than `max(column)` #79

Closed zdenall closed 1 year ago

zdenall commented 1 year ago

First of all, thanks a lot for developing this package, it adds some really nice features to gt!

I've encountered a little bug in gt_plt_bullet - looks like it considers only column values when setting axis range:

library(tibble)
library(gt)
library(gtExtras)

df <- tibble(A = 1:5, B = 1:5, C = c(3,4,5,6,7))

df %>% 
    gt() %>% 
    gt_plt_bullet(column = B, target = C)
image
jthomasmock commented 1 year ago

Fixed in latest GitHub version - thanks for the reprex/bug report!

library(tibble)
library(gt)
library(gtExtras)

df <- tibble(A = c(1:2, -3, 4:5), B = c(1:2, -3, 4:5), C = c(3,4,5,6,7))

df %>% 
  gt() %>% 
  gt_plt_bullet(column = B, target = C) %>%
  gtsave("test.png")

knitr::include_graphics("test.png")

Created on 2023-02-13 by the reprex package (v2.0.1)