Venn2 diagram

Hello all!
I try to display a Venn diagram (using venn2 function).
So I tried this code:
fig = venn2(subsets=(10, 5, 2, 1), set_labels=(‘Group A’, ‘Group B’,‘G’))
st.pyplot(fig)

But I get an AttributeError: ‘VennDiagram’ object has no attribute ‘savefig’

I understand why it happens but I can’t find a way to display my venn diagram…

Thanks!!

Hello @danarub, welcome to the community!

I have not tested the library, I’m going to take a wild guess and suppose VennDiagram is not the actual Matplotlib figure.
Using Support for Pandas charts? - #2 by andfanilo, does the following work? It looks like ax support was added in v0.6.

fig, ax = plt.subplots()
venn2(subsets=(10, 5, 2, 1), set_labels=("Group A", "Group B","G"), ax=ax)
st.pyplot(fig)

Have a nice day Streamlitin’
Fanilo :balloon:

Perfect thank you so much!!!

1 Like