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

Function test_hatching

lib/matplotlib/tests/test_legend.py:263–290  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

261
262@image_comparison(['hatching'], remove_text=True, style='default')
263def test_hatching():
264 # Remove legend texts when this image is regenerated.
265 fig, ax = plt.subplots()
266
267 # Patches
268 patch = plt.Rectangle((0, 0), 0.3, 0.3, hatch='xx',
269 label='Patch\ndefault color\nfilled')
270 ax.add_patch(patch)
271 patch = plt.Rectangle((0.33, 0), 0.3, 0.3, hatch='||', edgecolor='C1',
272 label='Patch\nexplicit color\nfilled')
273 ax.add_patch(patch)
274 patch = plt.Rectangle((0, 0.4), 0.3, 0.3, hatch='xx', fill=False,
275 label='Patch\ndefault color\nunfilled')
276 ax.add_patch(patch)
277 patch = plt.Rectangle((0.33, 0.4), 0.3, 0.3, hatch='||', fill=False,
278 edgecolor='C1',
279 label='Patch\nexplicit color\nunfilled')
280 ax.add_patch(patch)
281
282 # Paths
283 ax.fill_between([0, .15, .3], [.8, .8, .8], [.9, 1.0, .9],
284 hatch='+', label='Path\ndefault color')
285 ax.fill_between([.33, .48, .63], [.8, .8, .8], [.9, 1.0, .9],
286 hatch='+', edgecolor='C2', label='Path\nexplicit color')
287
288 ax.set_xlim(-0.01, 1.1)
289 ax.set_ylim(-0.01, 1.1)
290 ax.legend(handlelength=4, handleheight=4)
291
292
293def test_legend_remove():

Callers

nothing calls this directly

Calls 6

add_patchMethod · 0.80
subplotsMethod · 0.45
fill_betweenMethod · 0.45
set_xlimMethod · 0.45
set_ylimMethod · 0.45
legendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…