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