Helper for the tests below that test the extents of various Axes elements
(fig, ax)
| 8663 | |
| 8664 | |
| 8665 | def color_boxes(fig, ax): |
| 8666 | """ |
| 8667 | Helper for the tests below that test the extents of various Axes elements |
| 8668 | """ |
| 8669 | fig.canvas.draw() |
| 8670 | |
| 8671 | bbaxis = [] |
| 8672 | for nn, axx in enumerate([ax.xaxis, ax.yaxis]): |
| 8673 | bb = axx.get_tightbbox() |
| 8674 | if bb: |
| 8675 | axisr = mpatches.Rectangle( |
| 8676 | (bb.x0, bb.y0), width=bb.width, height=bb.height, |
| 8677 | linewidth=0.7, edgecolor='y', facecolor="none", transform=None, |
| 8678 | zorder=3) |
| 8679 | fig.add_artist(axisr) |
| 8680 | bbaxis += [bb] |
| 8681 | |
| 8682 | bbspines = [] |
| 8683 | for nn, a in enumerate(['bottom', 'top', 'left', 'right']): |
| 8684 | bb = ax.spines[a].get_window_extent() |
| 8685 | spiner = mpatches.Rectangle( |
| 8686 | (bb.x0, bb.y0), width=bb.width, height=bb.height, |
| 8687 | linewidth=0.7, edgecolor="green", facecolor="none", transform=None, |
| 8688 | zorder=3) |
| 8689 | fig.add_artist(spiner) |
| 8690 | bbspines += [bb] |
| 8691 | |
| 8692 | bb = ax.get_window_extent() |
| 8693 | rect2 = mpatches.Rectangle( |
| 8694 | (bb.x0, bb.y0), width=bb.width, height=bb.height, |
| 8695 | linewidth=1.5, edgecolor="magenta", facecolor="none", transform=None, |
| 8696 | zorder=2) |
| 8697 | fig.add_artist(rect2) |
| 8698 | bbax = bb |
| 8699 | |
| 8700 | bb2 = ax.get_tightbbox() |
| 8701 | rect2 = mpatches.Rectangle( |
| 8702 | (bb2.x0, bb2.y0), width=bb2.width, height=bb2.height, |
| 8703 | linewidth=3, edgecolor="red", facecolor="none", transform=None, |
| 8704 | zorder=1) |
| 8705 | fig.add_artist(rect2) |
| 8706 | bbtb = bb2 |
| 8707 | return bbaxis, bbspines, bbax, bbtb |
| 8708 | |
| 8709 | |
| 8710 | def test_normal_axes(): |
no test coverage detected
searching dependent graphs…