From 5358d71f46ca526eb128f6ac185fbffe15ff0f0d Mon Sep 17 00:00:00 2001 From: pixelsoup42 Date: Sat, 14 Oct 2023 02:26:08 +0200 Subject: [PATCH] subplots with redundant xticks --- .../cardano_account_pandas_dumper.py | 19 +++++++++++++------ .../matplotlib.rc | 16 +++++++--------- 2 files changed, 20 insertions(+), 15 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 b2b27f1..815fb2b 100644 --- a/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py +++ b/src/cardano_account_pandas_dumper/cardano_account_pandas_dumper.py @@ -595,14 +595,21 @@ def _plot_title(self): def plot_balance(self): """ Create a Matplotlib plot with the asset balance over time.""" - balance = self.make_balance_frame(with_total=False,raw_values=False).cumsum() - balance.plot( - title=self._plot_title(), - subplots=True - ) + balance = self.make_balance_frame(with_total=False,raw_values=False).cumsum().replace(pd.NA,0) + fig,ax=pyplot.subplots(len(balance.columns),2, + width_ratios=(7,1), + figsize=(11.69,2.0675*len(balance.columns))) + fig.suptitle(self._plot_title()) + for i in range(len((balance.columns))): + ax[i][1].axis("off") + balance.plot( + y=balance.columns[i], + ax=ax[i][0], + legend=False, + ) def get_graph_metadata(self, filename:str) -> Mapping : - """Return graph metadata depending on file extension.""" + """Return graph metadata for file name.""" save_format=os.path.splitext(filename)[1].removeprefix('.') if not save_format: save_format= mpl.rcParams["savefig.format"] diff --git a/src/cardano_account_pandas_dumper/matplotlib.rc b/src/cardano_account_pandas_dumper/matplotlib.rc index 29e42a4..fed8052 100644 --- a/src/cardano_account_pandas_dumper/matplotlib.rc +++ b/src/cardano_account_pandas_dumper/matplotlib.rc @@ -1,13 +1,11 @@ + axes.formatter.limits: -10, 12 axes.grid: True axes.grid.which: both -axes.titleweight: bold +axes.spines.bottom: False +axes.spines.left: True # display axis spines +axes.spines.right: False +axes.spines.top: False figure.constrained_layout.use: True -figure.figsize: 20,40 -legend.fontsize:medium -legend.frameon:False -legend.handleheight:2 -legend.handlelength:2 -legend.labelcolor:linecolor -legend.loc:upper left -savefig.pad_inches:0.5 +figure.titleweight: bold +savefig.pad_inches:0.5 \ No newline at end of file