A `.SubplotDivider` for laying out axes horizontally, while ensuring that they have equal heights. Examples -------- .. plot:: gallery/axes_grid1/demo_axes_hbox_divider.py
| 514 | |
| 515 | |
| 516 | class HBoxDivider(SubplotDivider): |
| 517 | """ |
| 518 | A `.SubplotDivider` for laying out axes horizontally, while ensuring that |
| 519 | they have equal heights. |
| 520 | |
| 521 | Examples |
| 522 | -------- |
| 523 | .. plot:: gallery/axes_grid1/demo_axes_hbox_divider.py |
| 524 | """ |
| 525 | |
| 526 | def new_locator(self, nx, nx1=None): |
| 527 | """ |
| 528 | Create an axes locator callable for the specified cell. |
| 529 | |
| 530 | Parameters |
| 531 | ---------- |
| 532 | nx, nx1 : int |
| 533 | Integers specifying the column-position of the |
| 534 | cell. When *nx1* is None, a single *nx*-th column is |
| 535 | specified. Otherwise, location of columns spanning between *nx* |
| 536 | to *nx1* (but excluding *nx1*-th column) is specified. |
| 537 | """ |
| 538 | return super().new_locator(nx, 0, nx1, 0) |
| 539 | |
| 540 | def _locate(self, nx, ny, nx1, ny1, axes, renderer): |
| 541 | # docstring inherited |
| 542 | nx += self._xrefindex |
| 543 | nx1 += self._xrefindex |
| 544 | fig_w, fig_h = self._fig.bbox.size / self._fig.dpi |
| 545 | x, y, w, h = self.get_position_runtime(axes, renderer) |
| 546 | summed_ws = self.get_horizontal_sizes(renderer) |
| 547 | equal_hs = self.get_vertical_sizes(renderer) |
| 548 | x0, y0, ox, hh = _locate( |
| 549 | x, y, w, h, summed_ws, equal_hs, fig_w, fig_h, self.get_anchor()) |
| 550 | if nx1 is None: |
| 551 | nx1 = -1 |
| 552 | x1, w1 = x0 + ox[nx] / fig_w, (ox[nx1] - ox[nx]) / fig_w |
| 553 | y1, h1 = y0, hh |
| 554 | return mtransforms.Bbox.from_bounds(x1, y1, w1, h1) |
| 555 | |
| 556 | |
| 557 | class VBoxDivider(SubplotDivider): |
no outgoing calls
searching dependent graphs…