Solve bug with multiple ax on same fig
This commit is contained in:
parent
ac4040641c
commit
d801d29dcb
|
@ -45,15 +45,16 @@ def pie_pivot_table(df, pies_per_lines = 3, **kwargs):
|
|||
pv = pd.pivot_table(df, **kwargs)
|
||||
return pivot_table_to_pie(pv, pies_per_lines)
|
||||
|
||||
def marks_hist(df):
|
||||
def marks_hist(df, **kwargs):
|
||||
""" Return axe for the histogramme of the dataframe
|
||||
|
||||
:param df: Dataframe with "Mark" and "Bareme" columns. If it has "Nom" column, it is use in title.
|
||||
:param kwargs: argument to pass to hist
|
||||
"""
|
||||
bareme = df["Bareme"].max()
|
||||
bins = int(bareme*2)
|
||||
|
||||
ax = df["Mark"].hist(bins = bins, range=(0,bareme))
|
||||
ax = df["Mark"].hist(bins = bins, range=(0,bareme), **kwargs)
|
||||
|
||||
try:
|
||||
nom = df["Nom"].unique()
|
||||
|
|
|
@ -81,7 +81,7 @@ def my_autopct(values):
|
|||
def pivot_table_to_pie(pv, pies_per_lines = 3):
|
||||
nbr_pies = len(pv.columns)
|
||||
nbr_cols = min(pies_per_lines, nbr_pies)
|
||||
nbr_rows = max(nbr_pies % nbr_cols,1)
|
||||
nbr_rows = nbr_pies // nbr_cols + 1
|
||||
f, axs = plt.subplots(nbr_rows, nbr_cols, figsize = (4*nbr_cols,4*nbr_rows))
|
||||
for (c, ax) in zip(pv, axs.flatten()):
|
||||
datas = pv[c]
|
||||
|
|
Loading…
Reference in New Issue