@@ -169,6 +169,21 @@ 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
+ tickdir = self ._tickdir
180
+ if tickdir == 'in' :
181
+ return 0.0
182
+ elif tickdir == 'inout' :
183
+ return self ._size / 2
184
+ elif tickdir == 'out' :
185
+ return self ._size
186
+
172
187
def get_children (self ):
173
188
children = [self .tick1line , self .tick2line ,
174
189
self .gridline , self .label1 , self .label2 ]
@@ -349,13 +364,11 @@ def apply_tickdir(self, tickdir):
349
364
350
365
if self ._tickdir == 'in' :
351
366
self ._tickmarkers = (mlines .TICKUP , mlines .TICKDOWN )
352
- self ._pad = self ._base_pad
353
367
elif self ._tickdir == 'inout' :
354
368
self ._tickmarkers = ('|' , '|' )
355
- self ._pad = self ._base_pad + self ._size / 2.
356
369
else :
357
370
self ._tickmarkers = (mlines .TICKDOWN , mlines .TICKUP )
358
- self ._pad = self ._base_pad + self ._size
371
+ self ._pad = self ._base_pad + self .get_tick_padding ()
359
372
self .stale = True
360
373
361
374
def _get_text1 (self ):
@@ -485,13 +498,11 @@ def apply_tickdir(self, tickdir):
485
498
486
499
if self ._tickdir == 'in' :
487
500
self ._tickmarkers = (mlines .TICKRIGHT , mlines .TICKLEFT )
488
- self ._pad = self ._base_pad
489
501
elif self ._tickdir == 'inout' :
490
502
self ._tickmarkers = ('_' , '_' )
491
- self ._pad = self ._base_pad + self ._size / 2.
492
503
else :
493
504
self ._tickmarkers = (mlines .TICKLEFT , mlines .TICKRIGHT )
494
- self ._pad = self ._base_pad + self ._size
505
+ self ._pad = self ._base_pad + self .get_tick_padding ()
495
506
self .stale = True
496
507
497
508
# how far from the y axis line the right of the ticklabel are
@@ -1067,7 +1078,7 @@ def _get_tick_bboxes(self, ticks, renderer):
1067
1078
def get_tightbbox (self , renderer ):
1068
1079
"""
1069
1080
Return a bounding box that encloses the axis. It only accounts
1070
- tick labels, axis label, and offsetText .
1081
+ tick labels, axis label, offsetText and ticks themselves .
1071
1082
"""
1072
1083
if not self .get_visible ():
1073
1084
return
@@ -1097,6 +1108,9 @@ def get_tightbbox(self, renderer):
1097
1108
else :
1098
1109
return None
1099
1110
1111
+ def get_tick_padding (self ):
1112
+ return self .majorTicks [0 ].get_tick_padding ()
1113
+
1100
1114
@allow_rasterization
1101
1115
def draw (self , renderer , * args , ** kwargs ):
1102
1116
'Draw the axis lines, grid lines, tick lines and labels'
0 commit comments