jthomasmock / gtExtras

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

gtExtra quantile motif distribution plot? #96

Closed roosheel-patel closed 1 year ago

roosheel-patel commented 1 year ago

I may be totally off, but did gtExtras ever support drawing histogram in the sytle of motif plots. Where instead of a histogram bar, you would show the numerical value (average) for that bin. The numerical value would be sized similar to the bar. In essence, you would generate something like below

0(fontsize = 0.1), 0(fontsize = 0.5), 1.1(fontsize = 3), 4.5(fontsize = 8), 7.7(fontsize = 8), 8.1(fontsize = 6.1), 9.9(fontsize = 4.1), 10.1(fontsize = 3), 12.5(fontsize = 1), 14.2(fontsize = 0.1)

Very sorry if I am confusing this for another package, but this quantile motif plot is something I'm currently trying to recreate.

jthomasmock commented 1 year ago

Howdy, that sounds like another package.

gtExtras + histogram is just specific to a sparkline.

library(gtExtras)
#> Loading required package: gt
mtcars %>%
  dplyr::group_by(cyl) %>%
  # must end up with list of data for each row in the input dataframe
  dplyr::summarize(mpg_data = list(mpg), .groups = "drop") %>%
  gt() %>%
  gt_plt_dist(mpg_data, type = "histogram", bw = 2) |> 
  gt_reprex_image()

Created on 2023-07-27 by the reprex package (v2.0.1)