MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / color_boxes

Function color_boxes

lib/matplotlib/tests/test_axes.py:8665–8707  ·  view source on GitHub ↗

Helper for the tests below that test the extents of various Axes elements

(fig, ax)

Source from the content-addressed store, hash-verified

8663
8664
8665def 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
8710def test_normal_axes():

Callers 5

test_normal_axesFunction · 0.85
test_nodecoratorFunction · 0.85
test_displaced_spineFunction · 0.85
test_tickdirsFunction · 0.85
test_minor_accountedforFunction · 0.85

Calls 4

drawMethod · 0.45
get_tightbboxMethod · 0.45
add_artistMethod · 0.45
get_window_extentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…