How can I create a venn diagram in python from 4 sets? Seems like the limit in matplotlib is only 3?
from matplotlib_venn import venn3
v = venn3(
[
set(ether_list),
set(bitcoin_list),
set(doge_list),
],
)
Venn diagrams with circles can work only with <4 sets, because the geometrical properties of intersections (some won't be possible to show). Some python libraries that allow you to show venn diagrams with more exotic shapes are:
There is a new python 3 package venny4py that can create Venn diagrams with up to 4 sets. It can plot and save figure or plot it as a subplot of your own matplotlib figure, figure size and dpi adjustable.
Example:
pip install venny4py
from venny4py.venny4py import *
#dict of sets
sets = {
'Set1': set(list("Harry Potter")),
'Set2': set(list("Hermione Granger")),
'Set3': set(list("Ron Weasley")),
'Set4': set(list("Severus Snape"))}
venny4py(sets=sets)

More details can be found here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With