8000 Simplified Norm · matplotlib/matplotlib@452e401 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 452e401

Browse files
committed
Simplified Norm
1 parent 5a3d14e commit 452e401

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/matplotlib/colorbar.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,13 @@ class ColorbarLogLocator(ticker.LogLocator):
249249
extrude into the "extend regions".
250250
251251
"""
252-
def __init__(self, colorbar, vmin, vmax, *args, **kwargs):
253-
self.vmin = vmin
254-
self.vmax = vmax
252+
def __init__(self, colorbar, *args, **kwargs):
255253
self._colorbar = colorbar
256254
ticker.LogLocator.__init__(self, *args, **kwargs)
257255

258256
def tick_values(self, vmin, vmax):
259-
vmin = max(vmin, self._colorbar.norm.vmin)
260-
vmax = min(vmax, self._colorbar.norm.vmax)
257+
vmin = self._colorbar.norm.vmin
258+
vmax = self._colorbar.norm.vmax
261259
ticks = ticker.LogLocator.tick_values(self, vmin, vmax)
262260
return ticks[(ticks >= vmin) & (ticks <= vmax)]
263261

@@ -447,7 +445,7 @@ def _get_ticker_locator_formatter(self):
447445
b = self.norm.boundaries
448446
locator = ticker.FixedLocator(b, nbins=10)
449447
elif isinstance(self.norm, colors.LogNorm):
450-
locator = ColorbarLogLocator(self, self.vmin, self.vmax)
448+
locator = ColorbarLogLocator(self)
451449
elif isinstance(self.norm, colors.SymLogNorm):
452450
# The subs setting here should be replaced
453451
# by logic in the locator.
@@ -495,15 +493,15 @@ def update_ticks(self):
495493
ax.yaxis.set_major_formatter(formatter)
496494
if type(self.norm) == colors.LogNorm:
497495
ax.yaxis.set_minor_locator(ColorbarLogLocator(self,
498-
self.vmin, self.vmax, 10., 'all'))
496+
base=10., subs='auto'))
499497
ax.yaxis.set_minor_formatter(ticker.NullFormatter())
500498

501499
else:
502500
ax.xaxis.set_major_locator(locator)
503501
ax.xaxis.set_major_formatter(formatter)
504502
if type(self.norm) == colors.LogNorm:
505503
ax.xaxis.set_minor_locator(ColorbarLogLocator(self,
506-
self.vmin, self.vmax, 10., 'all'))
504+
base=10., subs='auto'))
507505
ax.xaxis.set_minor_formatter(ticker.NullFormatter())
508506

509507
else:

lib/matplotlib/ticker.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2149,8 +2149,8 @@ def tick_values(self, vmin, vmax):
21492149
else:
21502150
subs = self._subs
21512151

2152+
# get decades between major ticks.
21522153
stride = 1
2153-
21542154
if rcParams['_internal.classic_mode']:
21552155
# Leave the bug left over from the PY2-PY3 transition.
21562156
while numdec / stride + 1 > numticks:
@@ -2171,6 +2171,8 @@ def tick_values(self, vmin, vmax):
21712171
if stride == 1:
21722172
ticklocs = np.ravel(np.outer(subs, ticklocs))
21732173
else:
2174+
# no ticklocs if we have more than one decade
2175+
# between major ticks.
21742176
ticklocs = []
21752177
else:
21762178
if have_subs:

0 commit comments

Comments
 (0)
0