()
| 1203 | |
| 1204 | |
| 1205 | def test_respects_bbox(): |
| 1206 | fig, axs = plt.subplots(2) |
| 1207 | for ax in axs: |
| 1208 | ax.set_axis_off() |
| 1209 | im = axs[1].imshow([[0, 1], [2, 3]], aspect="auto", extent=(0, 1, 0, 1)) |
| 1210 | im.set_clip_path(None) |
| 1211 | # Make the image invisible in axs[1], but visible in axs[0] if we pan |
| 1212 | # axs[1] up. |
| 1213 | im.set_clip_box(axs[0].bbox) |
| 1214 | buf_before = io.BytesIO() |
| 1215 | fig.savefig(buf_before, format="rgba") |
| 1216 | assert {*buf_before.getvalue()} == {0xff} # All white. |
| 1217 | axs[1].set(ylim=(-1, 0)) |
| 1218 | buf_after = io.BytesIO() |
| 1219 | fig.savefig(buf_after, format="rgba") |
| 1220 | assert buf_before.getvalue() != buf_after.getvalue() # Not all white. |
| 1221 | |
| 1222 | |
| 1223 | @check_figures_equal(extensions=['png', 'pdf', 'svg']) |
nothing calls this directly
no test coverage detected
searching dependent graphs…