From 991e714082af0dea691af28e126770e3460dc2b5 Mon Sep 17 00:00:00 2001 From: pseusys Date: Tue, 28 Feb 2023 01:05:09 +0100 Subject: [PATCH] height offset, equalized --- sources/graphics_chart_drawer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sources/graphics_chart_drawer.py b/sources/graphics_chart_drawer.py index d287408..70806d3 100644 --- a/sources/graphics_chart_drawer.py +++ b/sources/graphics_chart_drawer.py @@ -64,8 +64,11 @@ async def create_loc_graph(yearly_data: Dict, save_path: str): ax.spines["top"].set_visible(False) ax.spines["right"].set_visible(False) - max_offset = 1.05 * amax(cumulative.flatten()) - plt.ylim(top=max_offset, bottom=-max_offset) + max_offset = 0.05 * amax(cumulative.flatten()) + joined = cumulative.reshape(-1, cumulative.shape[-1]) + max_additions = amax(joined[:, 0]) + max_deletions = amax(joined[:, 1]) + plt.ylim(top=max_additions + max_offset, bottom=-max_deletions - max_offset) plt.savefig(save_path, bbox_inches="tight") plt.close(fig)