Skip to content

Create matplotlib.pyplot #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mikado77-mrp
Copy link

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()

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()
@mikado77-mrp
Copy link
Author

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()

@konstantint
Copy link
Owner

Sorry, I'm not sure I understand what this PR intends to achieve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants