Open toshiakiasakura opened 2 years ago
Code which produces the error. Title is only shown in the last part of the figure.
dfM = df_5y_each.copy() year = 2016 mosaic = [[1,2], [3,4],] #[5,6]] with cplt.Multiple(figsize=(6,6), dpi=300, mosaic=mosaic, sharex=True,sharey=True ) as mul: for i,year in enumerate([2016, 2017, 2018, 2019]): #, 2020]): with mul.Single(index=i+1, title="Title", xlabel=f"Total births", ylabel=f"Off-site deliveries", ) as p: total_col = ("total", year) offsite_col = ("offsite", year) p.ax.scatter(dfM[total_col], dfM[offsite_col], s=6) # Prediction dfM["count"] = 1 exog = pd.concat((dfM["count"], dfM[total_col]),axis=1) res = sm.OLS(dfM[offsite_col], exog).fit() pred_birth = [[1, 0],[1, dfM[total_col].max()]] pred_offsite = res.predict(pred_birth) p.ax.plot([0, dfM[total_col].max()], pred_offsite, ls="--") for city, x,y in zip(dfM.city, dfM[total_col], dfM[offsite_col], ): if y > 40 or x >20_000 or city == "茨城県": p.ax.annotate(city, (x,y), fontsize=8)
If using p.ax.set_title, the bug is solved.
p.ax.set_title
Code which produces the error. Title is only shown in the last part of the figure.