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

Skip to content

Commit 4f283d7

Browse files
committed
MNT: move NoNorm logic up to be on same footing on BoundryNorm
1 parent 6c95702 commit 4f283d7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/matplotlib/colorbar.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,13 @@ def _get_ticker_locator_formatter(self):
824824
b = self.norm.boundaries
825825
if locator is None:
826826
locator = ticker.FixedLocator(b, nbins=10)
827+
elif isinstance(self.norm, colors.NoNorm):
828+
if locator is None:
829+
# default locator:
830+
nv = len(self._values)
831+
base = 1 + int(nv / 10)
832+
# put ticks on integers between the boundaries of NoNorm...
833+
locator = ticker.IndexLocator(base=base, offset=.5)
827834
elif self.boundaries is not None:
828835
b = self._boundaries[self._inside]
829836
if locator is None:
@@ -835,12 +842,6 @@ def _get_ticker_locator_formatter(self):
835842
locator = self._long_axis().get_major_locator()
836843
if minorlocator is None:
837844
minorlocator = self._long_axis().get_minor_locator()
838-
if isinstance(self.norm, colors.NoNorm):
839-
# default locator:
840-
nv = len(self._values)
841-
base = 1 + int(nv / 10)
842-
# put ticks on integers between the boundaries of NoNorm...
843-
locator = ticker.IndexLocator(base=base, offset=.5)
844845

845846
if minorlocator is None:
846847
minorlocator = ticker.NullLocator()

0 commit comments

Comments
 (0)