8000 Merge pull request #21933 from jklymak/mnt-privatize-colorbar-attr · matplotlib/matplotlib@6b4e640 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6b4e640

Browse files
authored
Merge pull request #21933 from jklymak/mnt-privatize-colorbar-attr
MNT: privatize colorbar attr
2 parents c78cf12 + 10b3de9 commit 6b4e640

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lib/matplotlib/colorbar.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ class Colorbar:
360360

361361
n_rasterize = 50 # rasterize solids if number of colors >= n_rasterize
362362

363+
@_api.delete_parameter("3.6", "filled")
363364
def __init__(self, ax, mappable=None, *, cmap=None,
364365
norm=None,
365366
alpha=None,
@@ -440,7 +441,7 @@ def __init__(self, ax, mappable=None, *, cmap=None,
440441
self.spacing = spacing
441442
self.orientation = orientation
442443
self.drawedges = drawedges
443-
self.filled = filled
444+
self._filled = filled
444445
self.extendfrac = extendfrac
445446
self.extendrect = extendrect
446447
self.solids = None
@@ -489,7 +490,7 @@ def __init__(self, ax, mappable=None, *, cmap=None,
489490
self.formatter = ticker.StrMethodFormatter(format)
490491
else:
491492
self.formatter = format # Assume it is a Formatter or None
492-
self.draw_all()
493+
self._draw_all()
493494

494495
if isinstance(mappable, contour.ContourSet) and not mappable.filled:
495496
self.add_lines(mappable)
@@ -520,6 +521,8 @@ def _cbar_cla(self):
520521
# Also remove ._patch after deprecation elapses.
521522
patch = _api.deprecate_privatize_attribute("3.5", alternative="ax")
522523

524+
filled = _api.deprecate_privatize_attribute("3.6")
525+
523526
def update_normal(self, mappable):
524527
"""
525528
Update solid patches, lines, etc.
@@ -541,14 +544,22 @@ def update_normal(self, mappable):
541544
self.norm = mappable.norm
542545
self._reset_locator_formatter_scale()
543546

544-
self.draw_all()
547+
self._draw_all()
545548
if isinstance(self.mappable, contour.ContourSet):
546549
CS = self.mappable
547550
if not CS.filled:
548551
self.add_lines(CS)
549552
self.stale = True
550553

554+
@_api.deprecated("3.6", alternative="fig.draw_without_rendering()")
551555
def draw_all(self):
556+
"""
557+
Calculate any free parameters based on the current cmap and norm,
558+
and do all the drawing.
559+
"""
560+
self._draw_all()
561+
562+
def _draw_all(self):
552563
"""
553564
Calculate any free parameters based on the current cmap and norm,
554565
and do all the drawing.
@@ -589,7 +600,7 @@ def draw_all(self):
589600
# boundary norms + uniform spacing requires a manual locator.
590601
self.update_ticks()
591602

592-
if self.filled:
603+
if self._filled:
593604
ind = np.arange(len(self._values))
594605
if self._extend_lower():
595606
ind = ind[1:]
@@ -661,7 +672,7 @@ def _do_extends(self, extendlen):
661672

662673
# xyout is the path for the spine:
663674
self.outline.set_xy(xyout)
664-
if not self.filled:
675+
if not self._filled:
665676
return
666677

667678
# Make extend triangles or rectangles filled patches. These are

0 commit comments

Comments
 (0)
0