Skip to content

Instantly share code, notes, and snippets.

@judell
Last active October 28, 2024 04:05
Show Gist options
  • Save judell/5898ee2bc683e10f2742205b7a55fb99 to your computer and use it in GitHub Desktop.
Save judell/5898ee2bc683e10f2742205b7a55fb99 to your computer and use it in GitHub Desktop.
venn-diagram-python
# Import necessary libraries
import matplotlib.pyplot as plt
from matplotlib_venn import venn2

# Set up the Venn diagram for Mermaid and Graphviz features with no fills, just thick black borders
plt.figure(figsize=(8, 6))
venn = venn2(subsets=(1, 1, 1), set_labels=("Mermaid", "Graphviz"))

# Label each section with unique and shared features
venn.get_label_by_id('10').set_text("Git flows\nSequence diagrams\nUser journeys\nTimeline charts\nRequirements diagrams\nQuick prototyping")
venn.get_label_by_id('01').set_text("Complex layouts\nFine-grained control\nAdvanced edge routing\nSubgraph clustering\nMathematical graphs\nAdvanced node shapes")
venn.get_label_by_id('11').set_text("Flowcharts\nState diagrams\nERD diagrams\nClass diagrams\nBasic directed graphs")

# Set border color and width for the Venn diagram without fills
for patch_id in ['10', '01', '11']:
    venn.get_patch_by_id(patch_id).set_edgecolor('black')
    venn.get_patch_by_id(patch_id).set_linewidth(2)
    venn.get_patch_by_id(patch_id).set_facecolor('none')  # No fill color

# Display the plot
plt.title("Comparison of Mermaid vs Graphviz Features")
plt.show()

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment