@@ -169,6 +169,20 @@ def apply_tickdir(self, tickdir):
169
169
"""
170
170
pass
171
171
172
+ def get_tickdir (self ):
173
+ return self ._tickdir
174
+
175
+ def get_tick_padding (self ):
176
+ """
177
+ Get the length of the tick outside of the axes.
178
+ """
179
+ padding = {
180
+ 'in' : 0.0 ,
181
+ 'inout' : 0.5 ,
182
+ 'out' : 1.0
183
+ }
184
+ return self ._size * padding [self ._tickdir ]
185
+
172
186
def get_children (self ):
173
187
children = [self .tick1line , self .tick2line ,
174
188
self .gridline , self .label1 , self .label2 ]
@@ -349,13 +363,11 @@ def apply_tickdir(self, tickdir):
349
363
350
364
if self ._tickdir == 'in' :
351
365
self ._tickmarkers = (mlines .TICKUP , mlines .TICKDOWN )
352
- self ._pad = self ._base_pad
353
366
elif self ._tickdir == 'inout' :
354
367
self ._tickmarkers = ('|' , '|' )
355
- self ._pad = self ._base_pad + self ._size / 2.
356
368
else :
357
369
self ._tickmarkers = (mlines .TICKDOWN , mlines .TICKUP )
358
- self ._pad = self ._base_pad + self ._size
370
+ self ._pad = self ._base_pad + self .get_tick_padding ()
359
371
self .stale = True
360
372
361
373
def _get_text1 (self ):
@@ -485,13 +497,11 @@ def apply_tickdir(self, tickdir):
485
497
486
498
if self ._tickdir == 'in' :
487
499
self ._tickmarkers = (mlines .TICKRIGHT , mlines .TICKLEFT )
488
- self ._pad = self ._base_pad
489
500
elif self ._tickdir == 'inout' :
490
501
self ._tickmarkers = ('_' , '_' )
491
- self ._pad = self ._base_pad + self ._size / 2.
492
502
else :
493
503
self ._tickmarkers = (mlines .TICKLEFT , mlines .TICKRIGHT )
494
- self ._pad = self ._base_pad + self ._size
504
+ self ._pad = self ._base_pad + self .get_tick_padding ()
495
505
self .stale = True
496
506
497
507
# how far from the y axis line the right of the ticklabel are
@@ -1097,6 +1107,16 @@ def get_tightbbox(self, renderer):
1097
1107
else :
1098
1108
return None
1099
1109
1110
+ def get_tick_padding (self ):
1111
+ values = []
1112
+ if len (self .majorTicks ):
1113
+ values .append (self .majorTicks [0 ].get_tick_padding ())
1114
+ if len (self .minorTicks ):
1115
+ values .append (self .minorTicks [0 ].get_tick_padding ())
1116
+ if len (values ):
1117
+ return max (values )
1118
+ return 0.0
1119
+
1100
1120
@allow_rasterization
1101
1121
def draw (self , renderer , * args , ** kwargs ):
1102
1122
'Draw the axis lines, grid lines, tick lines and labels'
0 commit comments