@@ -538,11 +538,7 @@ def update_ticks(self):
538
538
long_axis .set_major_locator (locator )
539
539
long_axis .set_major_formatter (formatter )
540
540
if type (self .norm ) == colors .LogNorm :
541
- long_axis .set_minor_locator (_ColorbarLogLocator (self ,
542
- base = 10. , subs = 'auto' ))
543
- long_axis .set_minor_formatter (
544
- ticker .LogFormatterSciNotation ()
545
- )
541
+ self .minorticks_on ()
546
542
else :
547
543
_log .debug ('Using fixed locator on colorbar' )
548
544
ticks , ticklabels , offset_string = self ._ticker (locator , formatter )
@@ -602,6 +598,30 @@ def set_ticklabels(self, ticklabels, update_ticks=True):
602
598
cbook ._warn_external ("set_ticks() must have been called." )
603
599
self .stale = True
604
600
601
+ def minorticks_on (self ):
602
+ """
603
+ Turns on the minor ticks on the colorbar without extruding
604
+ into the "extend regions".
605
+ """
606
+ ax = self .ax
607
+ long_axis = ax .yaxis if self .orientation == 'vertical' else ax .xaxis
608
+
609
+ if long_axis .get_scale () == 'log' :
610
+ long_axis .set_minor_locator (_ColorbarLogLocator (self , base = 10. ,
611
+ subs = 'auto' ))
612
+ long_axis .set_minor_formatter (ticker .LogFormatterSciNotation ())
613
+ else :
614
+ long_axis .set_minor_locator (_ColorbarAutoMinorLocator (self ))
615
+
616
+ def minorticks_off (self ):
617
+ """
618
+ Turns off the minor ticks on the colorbar.
619
+ """
620
+ ax = self .ax
621
+ long_axis = ax .yaxis if self .orientation == 'vertical' else ax .xaxis
622
+
623
+ long_axis .set_minor_locator (ticker .NullLocator ())
624
+
605
625
def _config_axes (self , X , Y ):
606
626
'''
607
627
Make an axes patch and outline.
@@ -1209,33 +1229,6 @@ def remove(self):
1209
1229
# use_gridspec was True
1210
1230
ax .set_subplotspec (subplotspec )
1211
1231
1212
- def minorticks_on (self ):
1213
- """
1214
- Turns on the minor ticks on the colorbar without extruding
1215
- into the "extend regions".
1216
- """
1217
- ax = self .ax
1218
- long_axis = ax .yaxis if self .orientation == 'vertical' else ax .xaxis
1219
-
1220
- if long_axis .get_scale () == 'log' :
1221
- cbook ._warn_external ('minorticks_on() has no effect on a '
1222
- 'logarithmic colorbar axis' )
1223
- else :
1224
- long_axis .set_minor_locator (_ColorbarAutoMinorLocator (self ))
1225
-
1226
- def minorticks_off (self ):
1227
- """
1228
- Turns off the minor ticks on the colorbar.
1229
- """
1230
- ax = self .ax
1231
- long_axis = ax .yaxis if self .orientation == 'vertical' else ax .xaxis
1232
-
1233
- if long_axis .get_scale () == 'log' :
1234
- cbook ._warn_external ('minorticks_off() has no effect on a '
1235
- 'logarithmic colorbar axis' )
1236
- else :
1237
- long_axis .set_minor_locator (ticker .NullLocator ())
1238
-
1239
1232
1240
1233
@docstring .Substitution (make_axes_kw_doc )
1241
1234
def make_axes (parents , location = None , orientation = None , fraction = 0.15 ,
0 commit comments