| 646 | |
| 647 | @mpl.style.context('default') |
| 648 | def 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') |