@@ -1833,14 +1833,28 @@ def set_ticks(self, ticks, *, minor=False):
1833
1833
self .set_major_locator (mticker .FixedLocator (ticks ))
1834
1834
return self .get_major_ticks (len (ticks ))
1835
1835
1836
- def _get_tick_boxes_siblings (self , xdir , renderer ):
1836
+ def _get_tick_boxes_siblings (self , renderer ):
1837
1837
"""
1838
1838
Get the bounding boxes for this `.axis` and its siblings
1839
- as set by `.Figure.align_xlabels` or `.Figure.align_ylablels `.
1839
+ as set by `.Figure.align_xlabels` or `.Figure.align_ylabels `.
1840
1840
1841
1841
By default it just gets bboxes for self.
1842
1842
"""
1843
- raise NotImplementedError ('Derived must override' )
1843
+ bboxes = []
1844
+ bboxes2 = []
1845
+ # Get the Grouper keeping track of x or y label groups for this figure.
1846
+ axis_name , = [
1847
+ name for name , axis in self .axes ._get_axis_map ().items ()
1848
+ if name in self .figure ._align_label_groups and axis is self ]
1849
+ grouper = self .figure ._align_label_groups [axis_name ]
1850
+ # If we want to align labels from other axes:
1851
+ for ax in grouper .get_siblings (self .axes ):
1852
+ axis = ax ._get_axis_map ()[axis_name ]
1853
+ ticks_to_draw = axis ._update_ticks ()
1854
+ tlb , tlb2 = axis ._get_tick_bboxes (ticks_to_draw , renderer )
1855
+ bboxes .extend (tlb )
1856
+ bboxes2 .extend (tlb2 )
1857
+ return bboxes , bboxes2
1844
1858
1845
1859
def _update_label_position (self , renderer ):
1846
1860
"""
@@ -2039,25 +2053,6 @@ def set_label_position(self, position):
2039
2053
self .label_position = position
2040
2054
self .stale = True
2041
2055
2042
- def _get_tick_boxes_siblings (self , renderer ):
2043
- """
2044
- Get the bounding boxes for this `.axis` and its siblings
2045
- as set by `.Figure.align_xlabels` or `.Figure.align_ylablels`.
2046
-
2047
- By default it just gets bboxes for self.
2048
- """
2049
- bboxes = []
2050
- bboxes2 = []
2051
- # get the Grouper that keeps track of x-label groups for this figure
2052
- grp = self .figure ._align_xlabel_grp
2053
- # if we want to align labels from other axes:
2054
- for nn , axx in enumerate (grp .get_siblings (self .axes )):
2055
- ticks_to_draw = axx .xaxis ._update_ticks ()
2056
- tlb , tlb2 = axx .xaxis ._get_tick_bboxes (ticks_to_draw , renderer )
2057
- bboxes .extend (tlb )
2058
- bboxes2 .extend (tlb2 )
2059
- return bboxes , bboxes2
2060
-
2061
2056
def _update_label_position (self , renderer ):
2062
2057
"""
2063
2058
Update the label position based on the bounding box enclosing
@@ -2330,25 +2325,6 @@ def set_label_position(self, position):
2330
2325
self .label_position = position
2331
2326
self .stale = True
2332
2327
2333
- def _get_tick_boxes_siblings (self , renderer ):
2334
- """
2335
- Get the bounding boxes for this `.axis` and its siblings
2336
- as set by `.Figure.align_xlabels` or `.Figure.align_ylablels`.
2337
-
2338
- By default it just gets bboxes for self.
2339
- """
2340
- bboxes = []
2341
- bboxes2 = []
2342
- # get the Grouper that keeps track of y-label groups for this figure
2343
- grp = self .figure ._align_ylabel_grp
2344
- # if we want to align labels from other axes:
2345
- for axx in grp .get_siblings (self .axes ):
2346
- ticks_to_draw = axx .yaxis ._update_ticks ()
2347
- tlb , tlb2 = axx .yaxis ._get_tick_bboxes (ticks_to_draw , renderer )
2348
- bboxes .extend (tlb )
2349
- bboxes2 .extend (tlb2 )
2350
- return bboxes , bboxes2
2351
-
2352
2328
def _update_label_position (self , renderer ):
2353
2329
"""
2354
2330
Update the label position based on the bounding box enclosing
0 commit comments