【发布时间】:2021-03-18 13:37:06
【问题描述】:
这是我的主题
theme(
text = element_text(size = 14, color = "white"),
axis.text = element_text(size = 10, color = "white", face = "bold"),
axis.text.y =element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
plot.background = element_rect(fill = "transparent",colour = NA),
axis.line.x = element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.margin = unit(c(1, 1, 1, 1), "lines"),
legend.text = element_text(size = 10,
color = "white",
face = "bold",
margin = margin(l = 0.25, unit = "cm")
),
legend.title = element_blank(),
legend.background = element_rect(fill = "transparent",colour = NA)
)
ggplotly(plot)
一切都按预期工作,我可以使用所有颜色,但是当我将背景设置为透明时,结果是白色背景。 ggplotly 不接受透明背景吗?
【问题讨论】:
-
如果添加legend.box.background = element_rect(fill = "transparent") 和legend.key = element_rect(fill = "transparent", color = NA),
-
没有用。还是白的。