MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / AxesDivider

Class AxesDivider

lib/mpl_toolkits/axes_grid1/axes_divider.py:335–477  ·  view source on GitHub ↗

Divider based on the preexisting axes.

Source from the content-addressed store, hash-verified

333
334
335class AxesDivider(Divider):
336 """
337 Divider based on the preexisting axes.
338 """
339
340 def __init__(self, axes, xref=None, yref=None):
341 """
342 Parameters
343 ----------
344 axes : :class:`~matplotlib.axes.Axes`
345 xref
346 yref
347 """
348 self._axes = axes
349 if xref is None:
350 self._xref = Size.AxesX(axes)
351 else:
352 self._xref = xref
353 if yref is None:
354 self._yref = Size.AxesY(axes)
355 else:
356 self._yref = yref
357
358 super().__init__(fig=axes.get_figure(), pos=None,
359 horizontal=[self._xref], vertical=[self._yref],
360 aspect=None, anchor="C")
361
362 def _get_new_axes(self, *, axes_class=None, **kwargs):
363 axes = self._axes
364 if axes_class is None:
365 axes_class = type(axes)
366 return axes_class(axes.get_figure(), axes.get_position(original=True),
367 **kwargs)
368
369 def new_horizontal(self, size, pad=None, pack_start=False, **kwargs):
370 """
371 Helper method for ``append_axes("left")`` and ``append_axes("right")``.
372
373 See the documentation of `append_axes` for more details.
374
375 :meta private:
376 """
377 if pad is None:
378 pad = mpl.rcParams["figure.subplot.wspace"] * self._xref
379 pos = "left" if pack_start else "right"
380 if pad:
381 if not isinstance(pad, Size._Base):
382 pad = Size.from_any(pad, fraction_ref=self._xref)
383 self.append_size(pos, pad)
384 if not isinstance(size, Size._Base):
385 size = Size.from_any(size, fraction_ref=self._xref)
386 self.append_size(pos, size)
387 locator = self.new_locator(
388 nx=0 if pack_start else len(self._horizontal) - 1,
389 ny=self._yrefindex)
390 ax = self._get_new_axes(**kwargs)
391 ax.set_axes_locator(locator)
392 return ax

Callers 1

make_axes_locatableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…