Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f230ce1

Browse files
authored
Merge pull request #20481 from anntzer/cbp
2 parents 3d5c6d5 + 92a3fc4 commit f230ce1

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

doc/api/next_api_changes/behavior/20054-JMK.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ If a colorbar has lines added to it (e.g. for contour lines), these will
55
no longer be clipped. This is an improvement for lines on the edge of
66
the colorbar, but could lead to lines off the colorbar if the limits of
77
the colorbar are changed.
8+
9+
``Colorbar.patch`` is deprecated
10+
================================
11+
12+
This attribute is not correctly updated anymore.

lib/matplotlib/colorbar.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,11 @@ def __init__(self, ax, mappable=None, *, cmap=None,
451451
spine.set_visible(False)
452452
self.outline = self.ax.spines['outline'] = _ColorbarSpine(self.ax)
453453
self._short_axis().set_visible(False)
454-
self.patch = mpatches.Polygon(
454+
# Only kept for backcompat; remove after deprecation of .patch elapses.
455+
self._patch = mpatches.Polygon(
455456
np.empty((0, 2)),
456457
color=mpl.rcParams['axes.facecolor'], linewidth=0.01, zorder=-1)
457-
ax.add_artist(self.patch)
458+
ax.add_artist(self._patch)
458459

459460
self.dividers = collections.LineCollection(
460461
[],
@@ -487,6 +488,9 @@ def __init__(self, ax, mappable=None, *, cmap=None,
487488
if isinstance(mappable, contour.ContourSet) and not mappable.filled:
488489
self.add_lines(mappable)
489490

491+
# Also remove ._patch after deprecation elapses.
492+
patch = _api.deprecate_privatize_attribute("3.5")
493+
490494
def update_normal(self, mappable):
491495
"""
492496
Update solid patches, lines, etc.

0 commit comments

Comments
 (0)