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

Function test_autoscale_tight

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

Source from the content-addressed store, hash-verified

646
647@mpl.style.context('default')
648def test_autoscale_tight():
649 fig, ax = plt.subplots(1, 1)
650 ax.plot([1, 2, 3, 4])
651 ax.autoscale(enable=True, axis='x', tight=False)
652 ax.autoscale(enable=True, axis='y', tight=True)
653 assert_allclose(ax.get_xlim(), (-0.15, 3.15))
654 assert_allclose(ax.get_ylim(), (1.0, 4.0))
655
656 # Check that autoscale is on
657 assert ax.get_autoscalex_on()
658 assert ax.get_autoscaley_on()
659 assert ax.get_autoscale_on()
660 # Set enable to None
661 ax.autoscale(enable=None)
662 # Same limits
663 assert_allclose(ax.get_xlim(), (-0.15, 3.15))
664 assert_allclose(ax.get_ylim(), (1.0, 4.0))
665 # autoscale still on
666 assert ax.get_autoscalex_on()
667 assert ax.get_autoscaley_on()
668 assert ax.get_autoscale_on()
669
670
671@mpl.style.context('default')

Callers

nothing calls this directly

Calls 6

get_autoscale_onMethod · 0.80
subplotsMethod · 0.45
plotMethod · 0.45
autoscaleMethod · 0.45
get_xlimMethod · 0.45
get_ylimMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…