-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
MNT: privatize colorbar attr #21933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MNT: privatize colorbar attr #21933
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -370,6 +370,7 @@ class Colorbar: | |
|
||
n_rasterize = 50 # rasterize solids if number of colors >= n_rasterize | ||
|
||
@_api.delete_parameter("3.6", "filled") | ||
def __init__(self, ax, mappable=None, *, cmap=None, | ||
norm=None, | ||
alpha=None, | ||
|
@@ -450,7 +451,7 @@ def __init__(self, ax, mappable=None, *, cmap=None, | |
self.spacing = spacing | ||
self.orientation = orientation | ||
self.drawedges = drawedges | ||
self.filled = filled | ||
self._filled = filled | ||
self.extendfrac = extendfrac | ||
self.extendrect = extendrect | ||
self.solids = None | ||
|
@@ -499,7 +500,7 @@ def __init__(self, ax, mappable=None, *, cmap=None, | |
self.formatter = ticker.StrMethodFormatter(format) | ||
else: | ||
self.formatter = format # Assume it is a Formatter or None | ||
self.draw_all() | ||
self._draw_all() | ||
|
||
if isinstance(mappable, contour.ContourSet) and not mappable.filled: | ||
self.add_lines(mappable) | ||
|
@@ -530,6 +531,8 @@ def _cbar_cla(self): | |
# Also remove ._patch after deprecation elapses. | ||
patch = _api.deprecate_privatize_attribute("3.5", alternative="ax") | ||
|
||
filled = _api.deprecate_privatize_attribute("3.6") | ||
|
||
def update_normal(self, mappable): | ||
""" | ||
Update solid patches, lines, etc. | ||
|
@@ -551,14 +554,22 @@ def update_normal(self, mappable): | |
self.norm = mappable.norm | ||
self._reset_locator_formatter_scale() | ||
|
||
self.draw_all() | ||
self._draw_all() | ||
if isinstance(self.mappable, contour.ContourSet): | ||
CS = self.mappable | ||
if not CS.filled: | ||
self.add_lines(CS) | ||
self.stale = True | ||
|
||
@_api.deprecated("3.6", alternative="fig.draw_without_rendering()") | ||
def draw_all(self): | ||
""" | ||
Calculate any free parameters based on the current cmap and norm, | ||
and do all the drawing. | ||
""" | ||
self._draw_all() | ||
|
||
def _draw_all(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we rename this to As an aside, I'm wondering if this information should actually be in a |
||
""" | ||
Calculate any free parameters based on the current cmap and norm, | ||
and do all the drawing. | ||
|
@@ -599,7 +610,7 @@ def draw_all(self): | |
# boundary norms + uniform spacing requires a manual locator. | ||
self.update_ticks() | ||
|
||
if self.filled: | ||
if self._filled: | ||
ind = np.arange(len(self._values)) | ||
if self._extend_lower(): | ||
ind = ind[1:] | ||
|
@@ -671,7 +682,7 @@ def _do_extends(self, extendlen): | |
|
||
# xyout is the path for the spine: | ||
self.outline.set_xy(xyout) | ||
if not self.filled: | ||
if not self._filled: | ||
return | ||
|
||
# Make extend triangles or rectangles filled patches. These are | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does draw_without_rendering() actually hit this path? I guess so when the axes this colorbar is attached to gets called? But, it isn't obvious to me.