File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
lib/mpl_toolkits/axes_grid1 Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,15 @@ class CbarAxesBase(object):
6666
6767 def colorbar (self , mappable , ** kwargs ):
6868 locator = kwargs .pop ("locator" , None )
69- if locator is None :
70- locator = ticker .MaxNLocator (5 )
71- self .locator = locator
72-
73- kwargs ["ticks" ] = locator
7469
70+ if locator is None :
71+ if "ticks" not in kwargs :
72+ kwargs ["ticks" ] = ticker .MaxNLocator (5 )
73+ if locator is not None :
74+ if "ticks" in kwargs :
75+ raise ValueError ("Either *locator* or *ticks* need to be given, not both" )
76+ else :
77+ kwargs ["ticks" ] = locator
7578
7679 self .hold (True )
7780 if self .orientation in ["top" , "bottom" ]:
@@ -90,6 +93,9 @@ def on_changed(m):
9093
9194 self .cbid = mappable .callbacksSM .connect ('changed' , on_changed )
9295 mappable .set_colorbar (cb , self )
96+
97+ self .locator = cb .cbar_axis .get_major_locator ()
98+
9399 return cb
94100
95101 def _config_axes (self ):
You can’t perform that action at this time.
0 commit comments