Update the subplot position from ``figure.subplotpars``.
(self, figure, return_all=False)
| 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' |
no test coverage detected