()
| 8981 | |
| 8982 | |
| 8983 | def test_box_aspect(): |
| 8984 | # Test if axes with box_aspect=1 has same dimensions |
| 8985 | # as axes with aspect equal and adjustable="box" |
| 8986 | |
| 8987 | fig1, ax1 = plt.subplots() |
| 8988 | axtwin = ax1.twinx() |
| 8989 | axtwin.plot([12, 344]) |
| 8990 | |
| 8991 | ax1.set_box_aspect(1) |
| 8992 | assert ax1.get_box_aspect() == 1.0 |
| 8993 | |
| 8994 | fig2, ax2 = plt.subplots() |
| 8995 | ax2.margins(0) |
| 8996 | ax2.plot([0, 2], [6, 8]) |
| 8997 | ax2.set_aspect("equal", adjustable="box") |
| 8998 | |
| 8999 | fig1.canvas.draw() |
| 9000 | fig2.canvas.draw() |
| 9001 | |
| 9002 | bb1 = ax1.get_position() |
| 9003 | bbt = axtwin.get_position() |
| 9004 | bb2 = ax2.get_position() |
| 9005 | |
| 9006 | assert_array_equal(bb1.extents, bb2.extents) |
| 9007 | assert_array_equal(bbt.extents, bb2.extents) |
| 9008 | |
| 9009 | |
| 9010 | def test_box_aspect_custom_position(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…