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

Class SubplotDivider

lib/mpl_toolkits/axes_grid1/axes_divider.py:283–332  ·  view source on GitHub ↗

The Divider class whose rectangle area is specified as a subplot geometry.

Source from the content-addressed store, hash-verified

281
282
283class SubplotDivider(Divider):
284 """
285 The Divider class whose rectangle area is specified as a subplot geometry.
286 """
287
288 def __init__(self, fig, *args, horizontal=None, vertical=None,
289 aspect=None, anchor='C'):
290 """
291 Parameters
292 ----------
293 fig : `~matplotlib.figure.Figure`
294
295 *args : tuple (*nrows*, *ncols*, *index*) or int
296 The array of subplots in the figure has dimensions ``(nrows,
297 ncols)``, and *index* is the index of the subplot being created.
298 *index* starts at 1 in the upper left corner and increases to the
299 right.
300
301 If *nrows*, *ncols*, and *index* are all single digit numbers, then
302 *args* can be passed as a single 3-digit number (e.g. 234 for
303 (2, 3, 4)).
304 horizontal : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`, optional
305 Sizes for horizontal division.
306 vertical : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`, optional
307 Sizes for vertical division.
308 aspect : bool, optional
309 Whether overall rectangular area is reduced so that the relative
310 part of the horizontal and vertical scales have the same scale.
311 anchor : (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', \
312'NW', 'W'}, default: 'C'
313 Placement of the reduced rectangle, when *aspect* is True.
314 """
315 self.figure = fig
316 super().__init__(fig, [0, 0, 1, 1],
317 horizontal=horizontal or [], vertical=vertical or [],
318 aspect=aspect, anchor=anchor)
319 self.set_subplotspec(SubplotSpec._from_subplot_args(fig, args))
320
321 def get_position(self):
322 """Return the bounds of the subplot box."""
323 return self.get_subplotspec().get_position(self.figure).bounds
324
325 def get_subplotspec(self):
326 """Get the SubplotSpec instance."""
327 return self._subplotspec
328
329 def set_subplotspec(self, subplotspec):
330 """Set the SubplotSpec instance."""
331 self._subplotspec = subplotspec
332 self.set_position(subplotspec.get_position(self.figure))
333
334
335class AxesDivider(Divider):

Callers 2

demo_locatable_axes_hardFunction · 0.90
__init__Method · 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…