python - how to draw Venn Diagram using 6 sets - Stack Overflow
Does any one know how I can make an elegant venndiagram for 6 sets?
python - matplotlib Venn diagram, 6 circles - Stack Overflow
Create venn diagrams in R with circles one inside another - Stack Overflow
What are the key advantages of using a 6-circle Venn diagram over simpler Venn diagrams?
What are the common pitfalls to avoid when designing a 6-circle Venn diagram?
How can a 6-circle Venn diagram effectively illustrate complex relationships in data analysis?
Videos
I wrote a javascript library a while back that can do this: venn.js . It produces this output on the dataset you gave:

Its in javascript, but Kent Russell has provided a htmlwidgets interface to call it from R.
Code to produce this is:
// define set sizes and their intersection sizes
var sets = [
{sets: ['Ath'], size: 901},
{sets: ['Fve'], size: 14764},
{sets: ['Mdm'], size: 19408},
{sets: ['Pcmm'], size: 17714},
{sets: ['Pper'], size: 16948},
{sets: ['Pmum'], size: 17572},
{sets: ['Ath', 'Fve'], size: 823},
{sets: ['Ath', 'Mdm'], size: 846},
// need to specfiy the rest of the sets don't overlap
{sets: ['Ath', 'Pcmm'], size: 0},
{sets: ['Ath', 'Pper'], size: 0},
{sets: ['Ath', 'Pmum'], size: 0},
{sets: ['Fve', 'Mdm'], size: 0},
{sets: ['Fve', 'Pcmm'], size: 0},
{sets: ['Fve', 'Pper'], size: 0},
{sets: ['Fve', 'Pmum'], size: 0},
{sets: ['Mdm', 'Pcmm'], size: 0},
{sets: ['Mdm', 'Pper'], size: 0},
{sets: ['Mdm', 'Pmum'], size: 0},
{sets: ['Pcmm', 'Pper'], size: 0},
{sets: ['Pcmm', 'Pmum'], size: 0},
{sets: ['Pper', 'Pmum'], size: 0},
];
// draw the chart in the venn div
var chart = venn.VennDiagram();
d3.select("#venn").datum(sets).call(chart);
Thanks @ben-frederickson for both the answer and your fine venn.js library. If the user would like to solve the problem in R with the new d3vennR htmlwidget, here is my answer. It is not the most efficient method, but it works.
# devtools::install_github("timelyportfolio/d3vennR")
library(d3vennR)
library(sets)
sets_df <- read.csv(
textConnection("Ath,Fve,Mdm,Pcmm,Pper,Pmum,Counts
1,0,0,0,0,0,901
0,1,0,0,0,0,14764
0,0,1,0,0,0,19408
0,0,0,1,0,0,17714
0,0,0,0,1,0,16849
0,0,0,0,0,1,17572
1,1,0,0,0,0,823
1,0,1,0,0,0,846"
)
)
# get all sets provided and their counts/size
sets_list <- apply(
sets_df
,MARGIN=1
,function(rw){
list(
sets = as.list(colnames(sets_df)[which(rw==1)])
, size = as.numeric(tail(rw,1))
)
}
)
# get all set combinations to fill with size = 0 where missing
sets_combinations <- lapply(
# answer by venn.js authors only goes to combinations of m=2
# this goes to combinations of m = sets - 1
seq.int(1,length(colnames(sets_df))-2)
,function(m){
t(combn(colnames(sets_df)[-length(colnames(sets_df))],m=m))
}
)
# now combine the sets and sizes provided in data with the sets and 0
sets_venn <- unlist(
lapply(
sets_combinations
,function(x){
apply(
x
,MARGIN=1
,function(y){
# this gets sets of 0 which are not in the data provided
if(!set_contains_element(
as.set(lapply(sets_list,function(z){as.set(unlist(z$sets))}))
,as.set(y)
)){
list(sets=y,size=0)
} else {
# this gets sets with their sizes given by the partial data provided
unlist(
Filter(
function(z){
set_is_equal(as.set(y),as.set(unlist(z$sets)))
}
,sets_list
)
,recursive=F
)
}
}
)
}
)
,recursive=F
)
# produce the Venn Diagram in R with the transformed data
d3vennR( data = sets_venn )
I don't think so. The matplotlib-venn documentation says:
The package provides four main functions: venn2, venn2_circles, venn3 and venn3_circles.
Where venn2 is used to "draw a two-circle venn diagram" and venn3 is used to "draw a three-circle area-weighted venn diagram".
The venn package can handle up to 6 rings, see https://pypi.org/project/venn/
I don't think ggvenn allows a plot with this kind of relationship. However, it's not terribly difficult to draw it yourself with ggplot and geom_circle from ggforce
ggplot(data.frame(group = c("domínios", "possessões", "colônias"),
r = c(3, 2, 1)),
aes(x0 = 3 - r, y0 = 0, fill = factor(group, group))) +
geom_circle(aes(r = r), alpha = 1) +
geom_text(aes(x = c(0, 1, 2), y = c(2.3, 1.3, 0), label = group),
size = 8) +
scale_fill_manual(values = c('#77bca2', '#e1926b', '#a09cc8'),
guide = 'none') +
coord_equal() +
theme_void()

One way may use the package eulerr. However, your question isn't very clear so I let you play with the package
See the example below :
library(eulerr)
fit <- euler(c("A" = 10, "B" = 10, "A&B" = 8, "A&B&C"=3))
plot(fit,
fills = list(fill = c("red", "steelblue4","green"), alpha = 0.5),
labels = list(col = "black", font = 4),quantities = T)
