-
Notifications
You must be signed in to change notification settings - Fork 218
Closed
Milestone
Description
I ran into a bug with webshot when saving a gt table to png with gtsave() — the bold formatting was lost. I found this similar issue and managed to export the table with the bold formatting by saving as an .html and then using webshot2::webshot to render the png.
- make a nice gt table with bolded title row
library(gt)
library(dplyr)
test_table <- countrypops %>%
filter(year == "2017") %>%
slice_max(population, n = 10) %>%
select(country_name, population) %>%
gt() %>%
tab_style(
style = cell_text(weight = "bold"),
locations = cells_body(
columns = vars(country_name, population),
rows = population == max(population))
)
test_table- save to
png, but sadly no bold title row for me 😢
gtsave(test_table,
filename = "test_table.png")- save to
htmland used webshot2 to save topng🎉
gtsave(test_table,
filename = "test_table.html")
webshot2::webshot("test_table.html", "test_table.png")This issue might be something do to with my computing environment and webshot however just placing this here in case this might be is a useful enhancement for gtsave() to be able to leverage webshot2 when it hits CRAN.
SessionInfo() 👇
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] testthat_2.3.2 devtools_2.3.0 usethis_1.6.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 pillar_1.4.6 compiler_4.0.2
[4] later_1.1.0.1 prettyunits_1.1.1 remotes_2.1.1
[7] tools_4.0.2 digest_0.6.25 pkgbuild_1.1.0
[10] packrat_0.5.0 pkgload_1.1.0 evaluate_0.14
[13] lifecycle_0.2.0 tibble_3.0.3 jsonlite_1.7.0
[16] praise_1.0.0 memoise_1.1.0 pkgconfig_2.0.3
[19] rlang_0.4.7 reprex_0.3.0 cli_2.0.2
[22] rstudioapi_0.11 xfun_0.15 fastmap_1.0.1
[25] knitr_1.29 withr_2.2.0 webshot2_0.0.0.9000
[28] vctrs_0.3.1 desc_1.2.0 fs_1.4.2
[31] rprojroot_1.3-2 websocket_1.3.1 prompt_1.0.0
[34] chromote_0.0.0.9002 glue_1.4.1 R6_2.4.1
[37] processx_3.4.3 fansi_0.4.1 rmarkdown_2.3
[40] sessioninfo_1.1.1 clipr_0.7.0 whisker_0.4
[43] callr_3.4.3 magrittr_1.5 htmltools_0.5.0
[46] backports_1.1.8 bortles_0.0.0.9000 ps_1.3.3
[49] clisymbols_1.2.0 promises_1.1.1 ellipsis_0.3.1
[52] assertthat_0.2.1 crayon_1.3.4
vadimus202 and jthomasmock