Add hist_boxplot to ClassPOV
This commit is contained in:
@@ -67,6 +67,27 @@ def marks_hist(df, **kwargs):
|
||||
|
||||
return ax
|
||||
|
||||
def hist_boxplot(df, kwargs_hist=[], kwargs_box=[]):
|
||||
f, (ax_hist, ax_box) = plt.subplots(2, sharex=True,
|
||||
gridspec_kw={"height_ratios": (.85, .15)})
|
||||
|
||||
marks_hist(df, ax = ax_hist, rwidth=0.9)
|
||||
|
||||
ev_desc = df["Mark"].describe()
|
||||
m = ev_desc["mean"]
|
||||
|
||||
ax_hist.plot([m,m], ax_hist.get_ylim())
|
||||
ax_hist.annotate(round(ev_desc["mean"],1),
|
||||
xy=(ev_desc["mean"] + 0.2, ax_hist.get_ylim()[1]-0.2))
|
||||
|
||||
df["Mark"].plot.box(ax = ax_box, vert=False, widths = 0.6)
|
||||
ax_box.set_yticklabels("")
|
||||
for e in ["min", "25%", "50%", "75%", "max"]:
|
||||
ax_box.annotate(ev_desc[e],
|
||||
xy=(ev_desc[e] - 0.2, ax_box.get_ylim()[1]))
|
||||
|
||||
return f, (ax_hist, ax_box)
|
||||
|
||||
def parallel_on(df, index, student=None):
|
||||
""" Plot parallel one line by student
|
||||
|
||||
|
||||
Reference in New Issue
Block a user