I have a Venn diagram created in Python but I don't know how to smooth all (also the internal ones) the edges.
My code:
import matplotlib.pyplot as plt
from matplotlib_venn import venn3
from matplotlib.patches import PathPatch
from matplotlib.path import Path
set1 = {i for i in range(150)}
set2 = {i for i in range(150 - 75, 350 - 75)}
set3 = {i for i in range(150 - 75, 150 - 75 + 20)}
fig, ax = plt.subplots()
venn = venn3([set1, set2, set3], set_labels=('', '', ''))
circle1 = venn.get_patch_by_id('100')
circle2 = venn.get_patch_by_id('010')
circle3 = venn.get_patch_by_id('110')
circle4 = venn.get_patch_by_id('111')
circle1.set_edgecolor('none')
circle2.set_edgecolor('none')
circle3.set_edgecolor('none')
circle4.set_edgecolor('none')
path_data1 = circle1.get_path().vertices.tolist()
patch1 = PathPatch(Path(path_data1), facecolor='yellow', edgecolor='#d6d3d6', hatch='/', lw=0)
ax.add_patch(patch1)
path_data2 = circle2.get_path().vertices.tolist()
patch2 = PathPatch(Path(path_data2), facecolor='purple', edgecolor='#d6d3d6', hatch='\\', lw=0)
ax.add_patch(patch2)
path_data3 = circle3.get_path().vertices.tolist()
patch3 = PathPatch(Path(path_data3), facecolor='pink', edgecolor='#d6d3d6', hatch="\/", lw=0)
ax.add_patch(patch3)
path_data4 = circle4.get_path().vertices.tolist()
patch4 = PathPatch(Path(path_data4), facecolor='orange', edgecolor='#d6d3d6', hatch=".", lw=0)
ax.add_patch(patch4)
venn.get_label_by_id('100').set_text('')
venn.get_label_by_id('010').set_text('')
venn.get_label_by_id('110').set_text('')
venn.get_label_by_id('111').set_text('')
# Show the plot
plt.axis('off')
plt.show()
How to achieve that?
What's the cause of the angular edges here?
You are initializing the PathPatch objects using only the vertices of the "circles" returned by matplotlib-venn. Without explicit codes, PathPatch defaults to LINETO, i.e. drawing straight lines between vertices. You will want to use both, vertices and codes, to initialize your PathPatch instances.
path_data1 = circle1.get_path()
patch1 = PathPatch(path_data1, facecolor='yellow', edgecolor='#d6d3d6', hatch='/', lw=0)
# etc