ggplot2如何移除绘图周围的外边框

4

你好,我正在尝试去掉ggplot在我的图表周围放置的框。

以下是一些代码:

d = data.frame(x=rep(1:5,2), y=gl(2,5), height=abs(rnorm(10)))

ggplot(d, aes(x, y, height = height, group = y)) + 
   geom_ridgeline(fill="black", colour="white") +
   theme(panel.grid = element_blank(), panel.background = element_rect(fill = "#000000"), plot.background = element_rect(fill = "#000000"))

生成这张图片:

enter image description here

我想要去掉绕着我的图形的小灰线。

最初的回答:

You can remove the border by adding the following line of code:

plt.rcParams["axes.edgecolor"] = "white"

感谢,这确实解决了问题。 - Niels Janssen
如果问题已经解决,请接受答案。 - Jack Brookes
1个回答

9
尝试在theme中使用panel.background = element_rect(..., color = NA)作为参数。

在我的情况下(面部包裹),您需要在theme()中设置plot.background = element_rect(color = NA) - Paul

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接