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

Skip to content

Commit 8266e76

Browse files
committed
MNT: move NoNorm logic up to be on same footing on BoundryNorm
1 parent 8d3d03a commit 8266e76

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/matplotlib/colorbar.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,12 @@ 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+
# put ticks on integers between the boundaries of NoNorm
830+
nv = len(self._values)
831+
base = 1 + int(nv / 10)
832+
locator = ticker.IndexLocator(base=base, offset=.5)
827833
elif self.boundaries is not None:
828834
b = self._boundaries[self._inside]
829835
if locator is None:
@@ -835,12 +841,6 @@ def _get_ticker_locator_formatter(self):
835841
locator = self._long_axis().get_major_locator()
836842
if minorlocator is None:
837843
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)
844844

845845
if minorlocator is None:
846846
minorlocator = ticker.NullLocator()

0 commit comments

Comments
 (0)