From 55fd7830b79f3a997c50cf8c6326a59eff6c0195 Mon Sep 17 00:00:00 2001 From: pixelsoup42 Date: Thu, 12 Oct 2023 17:04:41 +0200 Subject: [PATCH] tweak ncols and loc --- .../cardano_account_pandas_dumper.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py b/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py index 5213500..b6b810e 100644 --- a/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py +++ b/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py @@ -668,7 +668,7 @@ def plot_balance(self): key=lambda i: [self.asset_names.get(x, x) for x in i], ) font_properties = FontProperties(size="small") - fig = pyplot.figure() + fig = pyplot.figure(constrained_layout=True) plot_ax=fig.add_subplot(1,2,1) legend_ax=fig.add_subplot(1,2,2) @@ -696,9 +696,9 @@ def plot_balance(self): prop=font_properties, handleheight=legend_font_scale, handlelength=legend_font_scale, - ncols=max(len(plot.get_lines())/assets_per_column,1), - frameon=False + ncols=int((len(plot.get_lines())+assets_per_column)/assets_per_column), + frameon=False, + loc="center right" ).get_texts(): text.set(y=text.get_window_extent().y0 + legend_font_scale * text_bbox.height / 2) - pyplot.tight_layout()