Skip to content

Commit 921e87c

Browse files
committed
Allow set_ticks to take a locator object, since this is valid for the ticks kwarg in __init__.
svn path=/trunk/matplotlib/; revision=8486
1 parent e755f60 commit 921e87c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/matplotlib/colorbar.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,11 @@ def set_ticks(self, ticks, update_ticks=True):
299299
set tick locations. Tick locations are updated immediately unless update_ticks is
300300
*False*. To manually update the ticks, call *update_ticks* method explicitly.
301301
"""
302-
self.locator = ticker.FixedLocator(ticks, nbins=len(ticks))
302+
if cbook.iterable(ticks):
303+
self.locator = ticker.FixedLocator(ticks, nbins=len(ticks))
304+
else:
305+
self.locator = ticks
306+
303307
if update_ticks:
304308
self.update_ticks()
305309

@@ -842,5 +846,3 @@ def make_axes(parent, **kw):
842846
cax = fig.add_axes(pbcb)
843847
cax.set_aspect(aspect, anchor=anchor, adjustable='box')
844848
return cax, kw
845-
846-

0 commit comments

Comments
 (0)