From 2e02f9bcfc4a32bb21b1c92399adb29ac4a6b9d1 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Mon, 3 Jan 2022 21:46:22 +0100 Subject: [PATCH 1/4] FIX --- lib/matplotlib/colorbar.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index b8da91c05109..39cacf7fc498 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -260,10 +260,9 @@ def __call__(self, ax, renderer): offset = extendlen[0] / len # we need to reset the aspect ratio of the axes to account # of the extends... - if hasattr(ax, '_colorbar_info'): - aspect = ax._colorbar_info['aspect'] - else: - aspect = False + + aspect = ax.get_box_aspect() + ax._colorbar_info['aspect'] = aspect # now shrink and/or offset to take into account the # extend tri/rectangles. if self._cbar.orientation == 'vertical': @@ -1467,7 +1466,6 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, anchor=anchor, panchor=panchor, fraction=fraction, - aspect=aspect0, pad=pad) # and we need to set the aspect ratio by hand... cax.set_anchor(anchor) From 462a38a9711b4c2005b51bb6a20e6e4627a383e1 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Mon, 3 Jan 2022 21:52:20 +0100 Subject: [PATCH 2/4] FIX: aspect ratio locked when colorbar created, not axes --- lib/matplotlib/colorbar.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 39cacf7fc498..7d594b896f0c 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -261,7 +261,6 @@ def __call__(self, ax, renderer): # we need to reset the aspect ratio of the axes to account # of the extends... - aspect = ax.get_box_aspect() ax._colorbar_info['aspect'] = aspect # now shrink and/or offset to take into account the # extend tri/rectangles. From 7299b00c17db335728edfcc15ff1a7e2f59eb6ea Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Mon, 3 Jan 2022 21:57:48 +0100 Subject: [PATCH 3/4] FIX: aspect ratio locked when colorbar created, not axes --- lib/matplotlib/colorbar.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 7d594b896f0c..7d18eff69f17 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -1465,6 +1465,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, anchor=anchor, panchor=panchor, fraction=fraction, + aspect=aspect0, pad=pad) # and we need to set the aspect ratio by hand... cax.set_anchor(anchor) From 18e05c5e0a5871adce4f26e6f596cc751d38c451 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Mon, 3 Jan 2022 22:00:11 +0100 Subject: [PATCH 4/4] FIX: aspect ratio locked when colorbar created, not axes --- lib/matplotlib/colorbar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 7d18eff69f17..e7b81e433a66 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -260,7 +260,7 @@ def __call__(self, ax, renderer): offset = extendlen[0] / len # we need to reset the aspect ratio of the axes to account # of the extends... - + aspect = self._cbar.ax.get_box_aspect() ax._colorbar_info['aspect'] = aspect # now shrink and/or offset to take into account the # extend tri/rectangles.