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

Function test_use_sticky_edges

lib/matplotlib/tests/test_axes.py:690–705  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

688
689@mpl.style.context('default')
690def test_use_sticky_edges():
691 fig, ax = plt.subplots()
692 ax.imshow([[0, 1], [2, 3]], origin='lower')
693 assert_allclose(ax.get_xlim(), (-0.5, 1.5))
694 assert_allclose(ax.get_ylim(), (-0.5, 1.5))
695 ax.use_sticky_edges = False
696 ax.autoscale()
697 xlim = (-0.5 - 2 * ax._xmargin, 1.5 + 2 * ax._xmargin)
698 ylim = (-0.5 - 2 * ax._ymargin, 1.5 + 2 * ax._ymargin)
699 assert_allclose(ax.get_xlim(), xlim)
700 assert_allclose(ax.get_ylim(), ylim)
701 # Make sure it is reversible:
702 ax.use_sticky_edges = True
703 ax.autoscale()
704 assert_allclose(ax.get_xlim(), (-0.5, 1.5))
705 assert_allclose(ax.get_ylim(), (-0.5, 1.5))
706
707
708@check_figures_equal()

Callers

nothing calls this directly

Calls 5

imshowMethod · 0.80
subplotsMethod · 0.45
get_xlimMethod · 0.45
get_ylimMethod · 0.45
autoscaleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…