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

Function test_normal_axes

lib/matplotlib/tests/test_axes.py:8710–8746  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8708
8709
8710def test_normal_axes():
8711 with rc_context({'_internal.classic_mode': False}):
8712 fig, ax = plt.subplots(dpi=200, figsize=(6, 6))
8713 fig.canvas.draw()
8714 plt.close(fig)
8715 bbaxis, bbspines, bbax, bbtb = color_boxes(fig, ax)
8716
8717 # test the axis bboxes
8718 target = [
8719 [124.0, 75.56, 982.0, 33.33],
8720 [86.89, 99.33, 52.0, 993.33],
8721 ]
8722 for nn, b in enumerate(bbaxis):
8723 targetbb = mtransforms.Bbox.from_bounds(*target[nn])
8724 assert_array_almost_equal(b.bounds, targetbb.bounds, decimal=1)
8725
8726 target = [
8727 [150.0, 119.999, 930.0, 11.111],
8728 [150.0, 1080.0, 930.0, 0.0],
8729 [150.0, 119.9999, 11.111, 960.0],
8730 [1068.8888, 119.9999, 11.111, 960.0]
8731 ]
8732 for nn, b in enumerate(bbspines):
8733 targetbb = mtransforms.Bbox.from_bounds(*target[nn])
8734 assert_array_almost_equal(b.bounds, targetbb.bounds, decimal=2)
8735
8736 target = [150.0, 119.99999999999997, 930.0, 960.0]
8737 targetbb = mtransforms.Bbox.from_bounds(*target)
8738 assert_array_almost_equal(bbax.bounds, targetbb.bounds, decimal=2)
8739
8740 target = [86.89, 75.56, 1019.11, 1017.11]
8741 targetbb = mtransforms.Bbox.from_bounds(*target)
8742 assert_array_almost_equal(bbtb.bounds, targetbb.bounds, decimal=1)
8743
8744 # test that get_position roundtrips to get_window_extent
8745 axbb = ax.get_position().transformed(fig.transFigure).bounds
8746 assert_array_almost_equal(axbb, ax.get_window_extent().bounds, decimal=2)
8747
8748
8749def test_nodecorator():

Callers

nothing calls this directly

Calls 9

rc_contextFunction · 0.90
color_boxesFunction · 0.85
from_boundsMethod · 0.80
subplotsMethod · 0.45
drawMethod · 0.45
closeMethod · 0.45
transformedMethod · 0.45
get_positionMethod · 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…