(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0)
| 459 | |
| 460 | |
| 461 | def make_margin_suptitles(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0): |
| 462 | # Figure out how large the suptitle is and make the |
| 463 | # top level figure margin larger. |
| 464 | |
| 465 | inv_trans_fig = fig.transFigure.inverted().transform_bbox |
| 466 | # get the h_pad and w_pad as distances in the local subfigure coordinates: |
| 467 | padbox = mtransforms.Bbox([[0, 0], [w_pad, h_pad]]) |
| 468 | padbox = (fig.transFigure - |
| 469 | fig.transSubfigure).transform_bbox(padbox) |
| 470 | h_pad_local = padbox.height |
| 471 | w_pad_local = padbox.width |
| 472 | |
| 473 | for sfig in fig.subfigs: |
| 474 | make_margin_suptitles(layoutgrids, sfig, renderer, |
| 475 | w_pad=w_pad, h_pad=h_pad) |
| 476 | |
| 477 | if fig._suptitle is not None and fig._suptitle.get_in_layout(): |
| 478 | p = fig._suptitle.get_position() |
| 479 | if getattr(fig._suptitle, '_autopos', False): |
| 480 | fig._suptitle.set_position((p[0], 1 - h_pad_local)) |
| 481 | bbox = inv_trans_fig(fig._suptitle.get_tightbbox(renderer)) |
| 482 | layoutgrids[fig].edit_margin_min('top', bbox.height + 2 * h_pad) |
| 483 | |
| 484 | if fig._supxlabel is not None and fig._supxlabel.get_in_layout(): |
| 485 | p = fig._supxlabel.get_position() |
| 486 | if getattr(fig._supxlabel, '_autopos', False): |
| 487 | fig._supxlabel.set_position((p[0], h_pad_local)) |
| 488 | bbox = inv_trans_fig(fig._supxlabel.get_tightbbox(renderer)) |
| 489 | layoutgrids[fig].edit_margin_min('bottom', |
| 490 | bbox.height + 2 * h_pad) |
| 491 | |
| 492 | if fig._supylabel is not None and fig._supylabel.get_in_layout(): |
| 493 | p = fig._supylabel.get_position() |
| 494 | if getattr(fig._supylabel, '_autopos', False): |
| 495 | fig._supylabel.set_position((w_pad_local, p[1])) |
| 496 | bbox = inv_trans_fig(fig._supylabel.get_tightbbox(renderer)) |
| 497 | layoutgrids[fig].edit_margin_min('left', bbox.width + 2 * w_pad) |
| 498 | |
| 499 | |
| 500 | def match_submerged_margins(layoutgrids, fig): |
no test coverage detected
searching dependent graphs…