Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Expire a mpl2.2-deprecated API #16184

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

Merged
merged 1 commit into from
Jan 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions doc/api/next_api_changes/behaviour.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ property. This now raises a TypeError.
`.FileMovieWriter` now defaults to writing temporary frames in a temporary
directory, which is always cleared at exit. In order to keep the individual
frames saved on the filesystem, pass an explicit *frame_prefix*.

`.Axes.plot` no longer accepts *x* and *y* being both 2D and with different numbers of columns
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Previously, calling `.Axes.plot` e.g. with *x* of shape ``(n, 3)`` and *y* of
shape ``(n, 2)`` would plot the first column of *x* against the first column
of *y*, the second column of *x* against the second column of *y*, **and** the
first column of *x* against the third column of *y*. This now raises an error
instead.
4 changes: 1 addition & 3 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,7 @@ def _plot_args(self, tup, kwargs):

ncx, ncy = x.shape[1], y.shape[1]
if ncx > 1 and ncy > 1 and ncx != ncy:
cbook.warn_deprecated(
"2.2", message="cycling among columns of inputs with "
"non-matching shapes is deprecated.")
raise ValueError(f"x has {ncx} columns but y has {ncy} columns")
return [func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
for j in range(max(ncx, ncy))]

Expand Down
10 changes: 3 additions & 7 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5479,12 +5479,13 @@ def test_square_plot():
ax.get_position(original=False).extents, (0.2125, 0.1, 0.8125, 0.9))


def test_no_None():
fig, ax = plt.subplots()
def test_bad_plot_args():
with pytest.raises(ValueError):
plt.plot(None)
with pytest.raises(ValueError):
plt.plot(None, None)
with pytest.raises(ValueError):
plt.plot(np.zeros((2, 2)), np.zeros((2, 3)))


@pytest.mark.parametrize(
Expand Down Expand Up @@ -6227,11 +6228,6 @@ def test_empty_errorbar_legend():
ax.legend()


def test_plot_columns_cycle_deprecation():
with pytest.warns(MatplotlibDeprecationWarning):
plt.plot(np.zeros((2, 2)), np.zeros((2, 3)))


@check_figures_equal(extensions=["png"])
def test_plot_decimal(fig_test, fig_ref):
x0 = np.arange(-10, 10, 0.3)
Expand Down