您好我想知道是否有一种方法可以保存使用 gt 包包创建的表格并用作具有透明背景的图像?
下面是一些示例代码,它创建一个 gt() 表并将该表保存为 png,但不透明
filter((Sepal.Length==5.1 & Species=='versicolor')) %>%
select(Sepal.Length,Sepal.Width,Petal.Length,Petal.Width) %>%
gt() %>%
tab_spanner(label = "Sepal", columns = vars(Sepal.Length, Sepal.Width)) %>%
tab_spanner(label = "Petal", columns = vars(Petal.Length, Petal.Width)) %>%
tab_options(
table.background.color = "transparent",
column_labels.font.size = 10.5,
table.font.size = 10,
heading.title.font.size = 24,
heading.title.font.weight = 'bold',
heading.subtitle.font.size = 11,
table.font.color = 'white',
table.border.top.color = "#0D2549",
data_row.padding = px(2),
footnotes.font.size = 8,
source_notes.font.size = 9,
footnotes.padding = px(1),
) %>%
opt_table_font(
font = list(
google_font("Chivo"),
default_fonts()
)
) %>%
gtsave("Image Name.png")