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

Skip to content

Commit 2100604

Browse files
committed
Deprecate Colorbar.patch.
It is not used at all anymore (its vertices are not even set correctly) since the switch to ColorbarAxes.
1 parent 3a265b3 commit 2100604

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
@@ -17,3 +17,8 @@ If a colorbar has lines added to it (e.g. for contour lines), these will
1717
no longer be clipped. This is an improvement for lines on the edge of
1818
the colorbar, but could lead to lines off the colorbar if the limits of
1919
the colorbar are changed.
20+
21+
``Colorbar.patch`` is deprecated
22+
================================
23+
24+
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
@@ -471,10 +471,11 @@ def __init__(self, ax, mappable=None, *, cmap=None,
471471
spine.set_visible(False)
472472
self.outline = self.ax.spines['outline'] = _ColorbarSpine(self.ax)
473473

474-
self.patch = mpatches.Polygon(
474+
# Only kept for backcompat; remove after deprecation.
475+
self._patch = mpatches.Polygon(
475476
np.empty((0, 2)),
476477
color=mpl.rcParams['axes.facecolor'], linewidth=0.01, zorder=-1)
477-
ax.add_artist(self.patch)
478+
ax.add_artist(self._patch)
478479

479480
self.dividers = collections.LineCollection(
480481
[],
@@ -507,6 +508,9 @@ def __init__(self, ax, mappable=None, *, cmap=None,
507508
if isinstance(mappable, contour.ContourSet) and not mappable.filled:
508509
self.add_lines(mappable)
509510

511+
# Also remove ._patch after deprecation elapses.
512+
patch = _api.deprecate_privatize_attribute("3.5")
513+
510514
def update_normal(self, mappable):
511515
"""
512516
Update solid patches, lines, etc.

0 commit comments

Comments
 (0)