8000 Let SecondaryAxis inherit get_tightbbox from _AxesBase. · matplotlib/matplotlib@119228b · GitHub
[go: up one dir, main page]

Skip to content

Commit 119228b

Browse files
committed
Let SecondaryAxis inherit get_tightbbox from _AxesBase.
The only difference in the implementation of _AxesBase.get_tightbbox and SecondaryAxis.get_tightbbox is that the latter explicitly ignores the axis in the "other" direction, but because that axis is set to invisible, its tightbbox is None. So we can just directly inherit the parent implementation.
1 parent 1e40243 commit 119228b

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

lib/matplotlib/axes/_secondary_axes.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -306,44 +306,6 @@ def _set_lims(self):
306306
lims = lims[::-1]
307307
set_lim(lims)
308308

309-
def get_tightbbox(self, renderer, call_axes_locator=True):
310-
"""
311-
Return the tight bounding box of the axes.
312-
The dimension of the Bbox in canvas coordinate.
313-
314-
If *call_axes_locator* is *False*, it does not call the
315-
_axes_locator attribute, which is necessary to get the correct
316-
bounding box. ``call_axes_locator==False`` can be used if the
317-
caller is only intereted in the relative size of the tightbbox
318-
compared to the axes bbox.
319-
"""
320-
321-
bb = []
322-
323-
if not self.get_visible():
324-
return None
325-
326-
self._set_lims()
327-
locator = self.get_axes_locator()
328-
if locator and call_axes_locator:
329-
pos = locator(self, renderer)
330-
self.apply_aspect(pos)
331-
else:
332-
self.apply_aspect()
333-
334-
if self._orientation == 'x':
335-
bb_axis = self.xaxis.get_tightbbox(renderer)
336-
else:
337-
bb_axis = self.yaxis.get_tightbbox(renderer)
338-
if bb_axis:
339-
bb.append(bb_axis)
340-
341-
bb.append(self.get_window_extent(renderer))
342-
_bbox = mtransforms.Bbox.union(
343-
[b for b in bb if b.width != 0 or b.height != 0])
344-
345-
return _bbox
346-
347309
def set_aspect(self, *args, **kwargs):
348310
"""
349311
Secondary axes cannot set the aspect ratio, so calling this just

0 commit comments

Comments
 (0)
0