From d103428796b52531377bb79185a3b0fd1ba42b95 Mon Sep 17 00:00:00 2001 From: Espen Fredrick <40804809+EspenFredrick@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:28:31 -0600 Subject: [PATCH 1/2] Update calplot.py Added colorbar options --- calplot/calplot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/calplot/calplot.py b/calplot/calplot.py index e721e5f..f8991a9 100644 --- a/calplot/calplot.py +++ b/calplot/calplot.py @@ -245,7 +245,7 @@ def calplot(data, how='sum', yearlabels=True, yearascending=True, yearlabel_kws=None, subplot_kws=None, gridspec_kws=None, figsize=None, fig_kws=None, colorbar=None, - suptitle=None, suptitle_kws=None, + suptitle=None, suptitle_kws=None, cbar_kws=None, tight_layout=True, **kwargs): """ Plot a timeseries as a calendar heatmap. @@ -355,11 +355,11 @@ def calplot(data, how='sum', if len(years) == 1: fig.colorbar(axes[0].get_children()[1], ax=axes.ravel().tolist(), - orientation='vertical') + orientation='vertical', label=cbar_kws) else: fig.subplots_adjust(right=0.8) cax = fig.add_axes([0.85, 0.025, 0.02, 0.95]) - fig.colorbar(axes[0].get_children()[1], cax=cax, orientation='vertical') + fig.colorbar(axes[0].get_children()[1], cax=cax, orientation='vertical', label=cbar_kws) stitle_kws.update(suptitle_kws) plt.suptitle(suptitle, **stitle_kws) From 15ab564973f78185577e0f6f89c80602ebfebde0 Mon Sep 17 00:00:00 2001 From: Espen Fredrick <40804809+EspenFredrick@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:34:20 -0600 Subject: [PATCH 2/2] Added 'colorbar_label' to calplot.py This adds the functionality to add a label to the colorbar. --- calplot/calplot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/calplot/calplot.py b/calplot/calplot.py index f8991a9..fab1cfe 100644 --- a/calplot/calplot.py +++ b/calplot/calplot.py @@ -244,8 +244,8 @@ def yearplot(data, year=None, how='sum', def calplot(data, how='sum', yearlabels=True, yearascending=True, yearlabel_kws=None, subplot_kws=None, gridspec_kws=None, - figsize=None, fig_kws=None, colorbar=None, - suptitle=None, suptitle_kws=None, cbar_kws=None, + figsize=None, fig_kws=None, colorbar=None, colorbar_label=None, + suptitle=None, suptitle_kws=None, tight_layout=True, **kwargs): """ Plot a timeseries as a calendar heatmap. @@ -355,11 +355,11 @@ def calplot(data, how='sum', if len(years) == 1: fig.colorbar(axes[0].get_children()[1], ax=axes.ravel().tolist(), - orientation='vertical', label=cbar_kws) + orientation='vertical', label=colorbar_label) else: fig.subplots_adjust(right=0.8) cax = fig.add_axes([0.85, 0.025, 0.02, 0.95]) - fig.colorbar(axes[0].get_children()[1], cax=cax, orientation='vertical', label=cbar_kws) + fig.colorbar(axes[0].get_children()[1], cax=cax, orientation='vertical', label=colorbar_label) stitle_kws.update(suptitle_kws) plt.suptitle(suptitle, **stitle_kws)