@@ -94,14 +94,14 @@ def __init__(self, axes, loc, label,
9494 self .label = self .label1 # legacy name
9595 self .label2 = self ._get_text2 ()
9696
97- self .update_position (loc )
98-
9997 self .gridOn = gridOn
10098 self .tick1On = tick1On
10199 self .tick2On = tick2On
102100 self .label1On = label1On
103101 self .label2On = label2On
104102
103+ self .update_position (loc )
104+
105105 def get_children (self ):
106106 children = [self .tick1line , self .tick2line , self .gridline , self .label1 , self .label2 ]
107107 return children
@@ -304,11 +304,16 @@ def update_position(self, loc):
304304 'Set the location of tick in data coords with scalar loc'
305305 x = loc
306306
307- self .tick1line .set_xdata ((x ,))
308- self .tick2line .set_xdata ((x ,))
309- self .gridline .set_xdata ((x , ))
310- self .label1 .set_x (x )
311- self .label2 .set_x (x )
307+ if self .tick1On :
308+ self .tick1line .set_xdata ((x ,))
309+ if self .tick2On :
310+ self .tick2line .set_xdata ((x ,))
311+ if self .gridOn :
312+ self .gridline .set_xdata ((x ,))
313+ if self .label1On :
314+ self .label1 .set_x (x )
315+ if self .label2On :
316+ self .label2 .set_x (x )
312317 self ._loc = loc
313318
314319 def get_view_interval (self ):
@@ -420,13 +425,16 @@ def _get_gridline(self):
420425 def update_position (self , loc ):
421426 'Set the location of tick in data coords with scalar loc'
422427 y = loc
423- self .tick1line .set_ydata ((y ,))
424- self .tick2line .set_ydata ((y ,))
425- self .gridline .set_ydata ((y , ))
426-
427- self .label1 .set_y ( y )
428- self .label2 .set_y ( y )
429-
428+ if self .tick1On :
429+ self .tick1line .set_ydata ((y ,))
430+ if self .tick2On :
431+ self .tick2line .set_ydata ((y ,))
432+ if self .gridOn :
433+ self .gridline .set_ydata ((y , ))
434+ if self .label1On :
435+ self .label1 .set_y ( y )
436+ if self .label2On :
437+ self .label2 .set_y ( y )
430438 self ._loc = loc
431439
432440
@@ -1231,6 +1239,8 @@ def set_ticks_position(self, position):
12311239 for t in ticks :
12321240 t .tick1On = True
12331241 t .tick2On = True
1242+ for t in ticks :
1243+ t .update_position (t ._loc )
12341244
12351245 def tick_top (self ):
12361246 'use ticks only on top'
0 commit comments