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: