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

Function test_inset

lib/matplotlib/tests/test_axes.py:8317–8343  ·  view source on GitHub ↗

Ensure that inset_ax argument is indeed optional

()

Source from the content-addressed store, hash-verified

8315
8316
8317def 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
8346def test_zoom_inset():

Callers

nothing calls this directly

Calls 8

pcolormeshMethod · 0.80
indicate_insetMethod · 0.80
subplotsMethod · 0.45
set_aspectMethod · 0.45
apply_aspectMethod · 0.45
drawMethod · 0.45
get_pointsMethod · 0.45
get_bboxMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…