Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
import matplotlib.pyplot as plt
from matplotlib_venn import venn3
Given data
economics = 150
statistics = 200
mathematics = 175
math_stat = 65
math_econ = 80
econ_stat = 50
all_three = 20
only_economics = economics - (math_econ + econ_stat + all_three) only_statistics = statistics - (math_stat + econ_stat + all_three) only_mathematics = mathematics - (math_stat + math_econ + all_three)
Create Venn Diagram
plt.figure(figsize=(6, 6))
venn = venn3(
subsets=(
only_economics, # Economics only
only_statistics, # Statistics only
econ_stat, # Economics & Statistics
only_mathematics, # Mathematics only
math_econ, # Mathematics & Economics
math_stat, # Mathematics & Statistics
all_three # All three subjects
),
set_labels=("Economics", "Statistics", "Mathematics")
)
Show the values in the diagram
for label in venn.set_labels:
label.set_fontsize(12)
for label in venn.subset_labels:
if label:
label.set_fontsize(10)
plt.title("Student Enrollment Venn Diagram")
plt.show()