.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "sphinx_gallery_output/plot_02_VennDiagram.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_sphinx_gallery_output_plot_02_VennDiagram.py: Venn diagrams ============= Venn diagrams show all possible relationships of inclusion and exclusion between two or more sets. The :py:class:`VennDiagram` class supports initialisation from - a dictionary mapping subsets to their sizes, and - directly from a list of sets. In the latter case, the subset sizes will be computed internally. Note that unlike in Euler diagrams, in Venn diagrams, the size of a subset does not influence the size of the corresponding area in the visualisation; only the subset labels are adjusted. .. GENERATED FROM PYTHON SOURCE LINES 20-48 .. image-sg:: /sphinx_gallery_output/images/sphx_glr_plot_02_VennDiagram_001.png :alt: plot 02 VennDiagram :srcset: /sphinx_gallery_output/images/sphx_glr_plot_02_VennDiagram_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt from matplotlib_set_diagrams import VennDiagram fig, (ax1, ax2) = plt.subplots(1, 2) VennDiagram( { (1, 0, 0) : 2, # {"a", "b"} (0, 1, 0) : 2, # {"e", "f"} (0, 0, 1) : 2, # {"h", "i"} (1, 1, 0) : 1, # {"c"} (1, 0, 1) : 1, # {"d"} (0, 1, 1) : 1, # {"g"} (1, 1, 1) : 0, # {} }, ax=ax1) VennDiagram.from_sets( [ {"a", "b", "c", "d"}, {"e", "f", "g", "c"}, {"h", "i", "g", "d"}, ], ax=ax2) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.476 seconds) .. _sphx_glr_download_sphinx_gallery_output_plot_02_VennDiagram.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_VennDiagram.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_VennDiagram.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_VennDiagram.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_