Ensure that inset_ax argument is indeed optional
()
| 8315 | |
| 8316 | |
| 8317 | def test_inset(): |
| 8318 | """ |
| 8319 | Ensure that inset_ax argument is indeed optional |
| 8320 | """ |
| 8321 | dx, dy = 0.05, 0.05 |
| 8322 | # generate 2 2d grids for the x & y bounds |
| 8323 | y, x = np.mgrid[slice(1, 5 + dy, dy), |
| 8324 | slice(1, 5 + dx, dx)] |
| 8325 | z = np.sin(x) ** 10 + np.cos(10 + y * x) * np.cos(x) |
| 8326 | |
| 8327 | fig, ax = plt.subplots() |
| 8328 | ax.pcolormesh(x, y, z[:-1, :-1]) |
| 8329 | ax.set_aspect(1.) |
| 8330 | ax.apply_aspect() |
| 8331 | # we need to apply_aspect to make the drawing below work. |
| 8332 | |
| 8333 | xlim = [1.5, 2.15] |
| 8334 | ylim = [2, 2.5] |
| 8335 | |
| 8336 | rect = [xlim[0], ylim[0], xlim[1] - xlim[0], ylim[1] - ylim[0]] |
| 8337 | |
| 8338 | inset = ax.indicate_inset(bounds=rect) |
| 8339 | assert inset.connectors is None |
| 8340 | fig.canvas.draw() |
| 8341 | xx = np.array([[1.5, 2.], |
| 8342 | [2.15, 2.5]]) |
| 8343 | assert np.all(inset.rectangle.get_bbox().get_points() == xx) |
| 8344 | |
| 8345 | |
| 8346 | def test_zoom_inset(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…