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

Function test_clipped_to_axes

lib/matplotlib/tests/test_tightlayout.py:385–406  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

383
384
385def test_clipped_to_axes():
386 # Ensure that _fully_clipped_to_axes() returns True under default
387 # conditions for all projection types. Axes.get_tightbbox()
388 # uses this to skip artists in layout calculations.
389 arr = np.arange(100).reshape((10, 10))
390 fig = plt.figure(figsize=(6, 2))
391 ax1 = fig.add_subplot(131, projection='rectilinear')
392 ax2 = fig.add_subplot(132, projection='mollweide')
393 ax3 = fig.add_subplot(133, projection='polar')
394 for ax in (ax1, ax2, ax3):
395 # Default conditions (clipped by ax.bbox or ax.patch)
396 ax.grid(False)
397 h, = ax.plot(arr[:, 0])
398 m = ax.pcolor(arr)
399 assert h._fully_clipped_to_axes()
400 assert m._fully_clipped_to_axes()
401 # Non-default conditions (not clipped by ax.patch)
402 rect = Rectangle((0, 0), 0.5, 0.5, transform=ax.transAxes)
403 h.set_clip_path(rect)
404 m.set_clip_path(rect.get_path(), rect.get_transform())
405 assert not h._fully_clipped_to_axes()
406 assert not m._fully_clipped_to_axes()
407
408
409def test_tight_pads():

Callers

nothing calls this directly

Calls 10

get_pathMethod · 0.95
RectangleClass · 0.90
figureMethod · 0.80
add_subplotMethod · 0.80
pcolorMethod · 0.80
gridMethod · 0.45
plotMethod · 0.45
set_clip_pathMethod · 0.45
get_transformMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…