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

Skip to content

Commit 8c27731

Browse files
committed
Improve handling of tick kwarg in colorbar
svn path=/trunk/matplotlib/; revision=3312
1 parent e25ff2b commit 8c27731

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/matplotlib/colorbar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def __init__(self, ax, cmap=None,
145145
self.solids = None
146146
self.lines = None
147147
if iterable(ticks):
148-
self.locator = ticker.FixedLocator(ticks, nbins=10)
148+
self.locator = ticker.FixedLocator(ticks, nbins=len(ticks))
149149
else:
150150
self.locator = ticks # Handle default in _ticker()
151151
if format is None:
@@ -492,7 +492,7 @@ def __init__(self, ax, mappable, **kw):
492492
kw['values'] = CS.cvalues
493493
kw['extend'] = CS.extend
494494
#kw['ticks'] = CS._levels
495-
kw.setdefault('ticks', CS.levels)
495+
kw.setdefault('ticks', ticker.FixedLocator(CS.levels, nbins=10))
496496
kw['filled'] = CS.filled
497497
ColorbarBase.__init__(self, ax, **kw)
498498
if not CS.filled:

0 commit comments

Comments
 (0)