如何使某些区域的某些区域的颜色为颜色,其余的空白?
例如,制作a∩b红色和其他所有白色。我已经附上了当前代码和Venn图的图像。
install.packages("ggplot2")
install.packages("ggVennDiagram")
library(ggplot2)
library(ggVennDiagram)
## Creating a Venn Diagram
# use data frame as input
test = list(A = 1:1,B = 1:1)
# create a Venn diagram and display all sets
ggVennDiagram(test,label = c("none")) +
scale_fill_gradient(low = "blue",high = "black") +
theme(legend.position = "none",plot.background = element_rect(fill = "steelblue"),
panel.border = element_rect(fill = NA),plot.margin = margin(10, 10, 10, 10))
For example, make A ∩ B red and everything else white. I've attached an image of my current code and Venn diagram.
install.packages("ggplot2")
install.packages("ggVennDiagram")
library(ggplot2)
library(ggVennDiagram)
## Creating a Venn Diagram
# use data frame as input
test = list(A = 1:1,B = 1:1)
# create a Venn diagram and display all sets
ggVennDiagram(test,label = c("none")) +
scale_fill_gradient(low = "blue",high = "black") +
theme(legend.position = "none",plot.background = element_rect(fill = "steelblue"),
panel.border = element_rect(fill = NA),plot.margin = margin(10, 10, 10, 10))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ggvenndiagram
并非明确设计用于绘制设置成员资格的图表,但可以这样做。如果使用以下设置:那么您可以轻松地指定会员资格 /非会员领域:首先,指定要指示区域是否在集合中的颜色:
现在您可以绘制集合如下所示:
img src =“ https://i.sstatic.net/dduui.png
< img src =“ https://i.sstatic.net/52bht.png” alt
=“ https://i.sstatic.net/saock.png”
=“”>
希望您在这里有足够的时间为您想要适当的任何元素上色。
由
ggVennDiagram
isn't designed explicitly to draw diagrams of set membership, but it can be made to do so. If you use the following set-up:Then you can easily specify the membership / non-membership areas like this: first, specify the colors that you want to indicate whether an area is within the set or not:
Now you can draw the sets as follows:
Hopefully you have enough here to color any element you want appropriately.
Created on 2022-06-17 by the reprex package (v2.0.1)