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

Skip to content

Commit 92c733f

Browse files
committed
TST
1 parent 6773228 commit 92c733f

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3502,7 +3502,7 @@ def set_xscale(self, value, **kwargs):
35023502
Parameters
35033503
----------
35043504
value : {"linear", "log", "symlog", "logit", ...} or `.ScaleBase`
3505-
The axis scale type to apply.
3505+
The axis scale type to apply.
35063506
35073507
**kwargs
35083508
Different keyword arguments are accepted, depending on the scale.

lib/matplotlib/colorbar.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,9 +593,11 @@ def _use_auto_colorbar_locator(self):
593593
Return if we should use an adjustable tick locator or a fixed
594594
one. (check is used twice so factored out here...)
595595
"""
596-
contouring = self.boundaries is not None and self.spacing == 'uniform'
597-
return (type(self.norm) in [colors.Normalize, colors.LogNorm] and
598-
not contouring)
596+
if isinstance(self.norm, colors.BoundaryNorm):
597+
return False
598+
if (self.boundaries is not None and self.spacing == 'uniform'):
599+
return False
600+
return True
599601

600602
def _reset_locator_formatter_scale(self):
601603
"""
@@ -626,7 +628,6 @@ def update_ticks(self):
626628
ax = self.ax
627629
# Get the locator and formatter; defaults to self.locator if not None.
628630
self._get_ticker_locator_formatter()
629-
630631
if self._use_auto_colorbar_locator():
631632
_log.debug('Using auto colorbar locator %r on colorbar',
632633
self.locator)

lib/matplotlib/tests/test_colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ def test_SymLogNorm_single_zero():
666666
norm = mcolors.SymLogNorm(1e-5, vmin=-1, vmax=1, base=np.e)
667667
cbar = mcolorbar.ColorbarBase(fig.add_subplot(), norm=norm)
668668
ticks = cbar.get_ticks()
669-
assert sum(ticks == 0) == 1
669+
assert np.count_nonzero(ticks == 0) <= 1
670670
plt.close(fig)
671671

672672

0 commit comments

Comments
 (0)