MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / get_position

Method get_position

site-packages/matplotlib/gridspec.py:478–498  ·  view source on GitHub ↗

Update the subplot position from ``figure.subplotpars``.

(self, figure, return_all=False)

Source from the content-addressed store, hash-verified

476 return nrows, ncols, row_start, row_stop, col_start, col_stop
477
478 def get_position(self, figure, return_all=False):
479 """Update the subplot position from ``figure.subplotpars``.
480 """
481 gridspec = self.get_gridspec()
482 nrows, ncols = gridspec.get_geometry()
483 rows, cols = np.unravel_index(
484 [self.num1] if self.num2 is None else [self.num1, self.num2],
485 (nrows, ncols))
486 fig_bottoms, fig_tops, fig_lefts, fig_rights = \
487 gridspec.get_grid_positions(figure)
488
489 fig_bottom = fig_bottoms[rows].min()
490 fig_top = fig_tops[rows].max()
491 fig_left = fig_lefts[cols].min()
492 fig_right = fig_rights[cols].max()
493 figbox = Bbox.from_extents(fig_left, fig_bottom, fig_right, fig_top)
494
495 if return_all:
496 return figbox, rows[0], cols[0], nrows, ncols
497 else:
498 return figbox
499
500 def get_topmost_subplotspec(self):
501 'get the topmost SubplotSpec instance associated with the subplot'

Callers 1

get_subplot_paramsMethod · 0.45

Calls 6

get_gridspecMethod · 0.95
get_grid_positionsMethod · 0.80
from_extentsMethod · 0.80
get_geometryMethod · 0.45
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected