什么是在我的Venn图周围添加矩形或边框以代表通用集的最简单方法?

发布于 2025-02-07 08:26:10 字数 122 浏览 1 评论 0 原文

我正在使用ggplot2和ggvenndiagram软件包。我有两套“ A”和“ B”,它们在它们后面有白色空间。我想知道是否有一种简单的方法可以简单地在集合周围添加类似于 box()的矩形边框。

I'm using the ggplot2 and ggVennDiagram packages. I have two sets "A" and "B" that are colored in and have white space behind them. I'm wondering if there is an easy way to simply add a rectangular border around the sets similar to box() when plotting a graph in R.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自演自醉 2025-02-14 08:26:10

ggvenndiagram 帮助页面为例,让我们绘制一个示例:

library(ggVennDiagram)

x <- list(A = 1:5, B = 2:7, C  =3:6, D = 4:9)

ggVennDiagram(x)

“在此处添加一个盒子”

要在此添加一个盒子,请注意,由于它实际上是一个ggplot,因此删除了面板边框,因此我们可以将其添加回

ggVennDiagram(x) + theme(panel.border = element_rect(fill = NA),
                         plot.margin = margin(10, 10, 10, 10))

”在此处输入图像说明”

Taking an example from the ggVennDiagram help page, let's draw an example:

library(ggVennDiagram)

x <- list(A = 1:5, B = 2:7, C  =3:6, D = 4:9)

ggVennDiagram(x)

enter image description here

To add a box around this, note that since it is actually a ggplot with the panel border removed, we can just add it back in

ggVennDiagram(x) + theme(panel.border = element_rect(fill = NA),
                         plot.margin = margin(10, 10, 10, 10))

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文