File tree 1 file changed +11
-5
lines changed
lib/mpl_toolkits/axes_grid1
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,15 @@ class CbarAxesBase(object):
66
66
67
67
def colorbar (self , mappable , ** kwargs ):
68
68
locator = kwargs .pop ("locator" , None )
69
- if locator is None :
70
- locator = ticker .MaxNLocator (5 )
71
- self .locator = locator
72
-
73
- kwargs ["ticks" ] = locator
74
69
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
75
78
76
79
self .hold (True )
77
80
if self .orientation in ["top" , "bottom" ]:
@@ -90,6 +93,9 @@ def on_changed(m):
90
93
91
94
self .cbid = mappable .callbacksSM .connect ('changed' , on_changed )
92
95
mappable .set_colorbar (cb , self )
96
+
97
+ self .locator = cb .cbar_axis .get_major_locator ()
98
+
93
99
return cb
94
100
95
101
def _config_axes (self ):
You can’t perform that action at this time.
0 commit comments