Skip to content

[MRG+1] plot_date() after axhline() doesn't rescale axes #8205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
12 changes: 12 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4991,3 +4991,15 @@ def test_datetime_axhline_same_axes():
axs[1].plot(xvalues, yvalues)

assert (axs[0].get_xlim() == axs[1].get_xlim())


def test_invalid_axis_limits():
plt.plot([0, 1], [0, 1])
with pytest.raises(ValueError):
plt.xlim(np.nan)
with pytest.raises(ValueError):
plt.xlim(np.inf)
with pytest.raises(ValueError):
plt.ylim(np.nan)
with pytest.raises(ValueError):
plt.ylim(np.inf)