Skip to content
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

Explain how to read a boxplot #453

Open
ArturoAmorQ opened this issue Sep 8, 2021 · 0 comments
Open

Explain how to read a boxplot #453

ArturoAmorQ opened this issue Sep 8, 2021 · 0 comments
Labels
Milestone

Comments

@ArturoAmorQ
Copy link
Collaborator

Box-plots are frequently used during the MOOC but a person without a minimal formation in statistics might not understand how to read them.
I think the soon-to-be-added notebook on score distributions gives us a good opportunity to add a brief explanation/illustration on how to do so.

Using the same example as presented in #416 to illustrate overlapping score distribution, I propose adding both the following code and figures:

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

plt.rcParams["figure.figsize"] = (10,7)
plt.rcParams.update({'font.size': 16}) 
np.random.seed(12)

model_1 = pd.DataFrame([0.65,0.7,0.71,0.73,0.78],columns=['model_1'])
model_2 = list(np.random.normal(0.74, 0.07, 5))
model_2 = pd.DataFrame(model_2,columns=['model_2'])
models = pd.concat([model_1,model_2], axis=1)

bins=[0.6,0.64,0.68,0.72,0.76,0.8,0.84]
fig, ax1 = plt.subplots()
ax1.hist(models, bins=bins, label=['model_1', 'model_2'])
ax1.set_ylabel("frequency")
ax1.set_xlabel("test_score")
ax1.legend()
plt.tight_layout()
_ = plt.title("Overlapping score distributions")

overlapping_plot

color = {"whiskers": "black", "medians": "black", "caps": "black"}

models.plot.box(vert=False, color=color)
_ = plt.title("Computation of multiple scores using a boxplot")

boxplot

Having both things on the same notebook would show how useful a box-plot is when comparing several distributions at once.

What do you think?

@lesteve lesteve added the video label Jan 6, 2022
@lesteve lesteve added this to the MOOC 3.0 milestone Jan 6, 2022
@lesteve lesteve modified the milestones: MOOC 3.0, MOOC 4.0 Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants