R 能否将背景透明的gt()表保存为png
您好,我想知道是否有办法将使用gt软件包创建的表保存为具有透明背景的图像 下面是一些创建gt()表并将该表另存为png但不透明的示例代码R 能否将背景透明的gt()表保存为png,r,transparency,gt,R,Transparency,Gt,您好,我想知道是否有办法将使用gt软件包创建的表保存为具有透明背景的图像 下面是一些创建gt()表并将该表另存为png但不透明的示例代码 filter((Sepal.Length==5.1 & Species=='versicolor')) %>% select(Sepal.Length,Sepal.Width,Petal.Length,Petal.Width) %>% gt() %>% tab_spanner(label = "Sepal&q
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")
使用png()
后跟par(bg=NA)
,然后绘制,最后使用dev.off()
。您还可以使用gtsave(“Image Name.png”,bg=NA)
。