From 8988155bc5b97743da0e416a403c765b065398b8 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Tue, 3 Nov 2020 14:04:36 -0800 Subject: [PATCH] Backport: manual --- lib/matplotlib/colorbar.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 0dc84edc2acc..4b2f86003eaa 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -788,6 +788,9 @@ def _add_solids(self, X, Y, C): Draw the colors using `~.axes.Axes.pcolormesh`; optionally add separators. """ + if C.shape[0] == Y.shape[0]: + # trim the last one to be compatible with old behavior. + C = C[:-1] if self.orientation == 'vertical': args = (X, Y, C) else: