嗨,我想知道是否有一种方法可以保存使用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")发布于 2021-11-17 12:28:28
以下是我在我的闪亮应用程序中使用CSS颜色使GT表背景透明的方法。
tab_options(
table.background.color = "#FFFFFF00",
column_labels.font.size = px(10),
column_labels.font.weight = "bold",
table.font.color = "white",
table.font.size = px(12L)
)下面是表格的样子。请注意,闪亮的应用程序的背景是黑色的,所以表格显示为黑色(尽管它实际上是透明的)。

https://stackoverflow.com/questions/67403743
复制相似问题