Skip to content

MNT: Remove dead code in Colorbar #23269

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

Merged
merged 1 commit into from
Jun 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions lib/matplotlib/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def __init__(self, ax, mappable=None, *, cmap=None,
if np.iterable(ticks):
self._locator = ticker.FixedLocator(ticks, nbins=len(ticks))
else:
self._locator = ticks # Handle default in _ticker()
self._locator = ticks

if isinstance(format, str):
# Check format between FormatStrFormatter and StrMethodFormatter
Expand Down Expand Up @@ -1095,32 +1095,6 @@ def remove(self):
# use_gridspec was True
ax.set_subplotspec(subplotspec)

def _ticker(self, locator, formatter):
"""
Return the sequence of ticks (colorbar data locations),
ticklabels (strings), and the corresponding offset string.
"""
if isinstance(self.norm, colors.NoNorm) and self.boundaries is None:
intv = self._values[0], self._values[-1]
else:
intv = self.vmin, self.vmax
locator.create_dummy_axis(minpos=intv[0])
locator.axis.set_view_interval(*intv)
locator.axis.set_data_interval(*intv)
formatter.set_axis(locator.axis)

b = np.array(locator())
if isinstance(locator, ticker.LogLocator):
eps = 1e-10
b = b[(b <= intv[1] * (1 + eps)) & (b >= intv[0] * (1 - eps))]
else:
eps = (intv[1] - intv[0]) * 1e-10
b = b[(b <= intv[1] + eps) & (b >= intv[0] - eps)]
ticks = self._locate(b)
ticklabels = formatter.format_ticks(b)
offset_string = formatter.get_offset()
return ticks, ticklabels, offset_string

def _process_values(self):
"""
Set `_boundaries` and `_values` based on the self.boundaries and
Expand Down