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

Skip to content

Commit 2fdfbdf

Browse files
committed
Deprecate column cycling when plot() inputs have nonmatching shapes.
Currently, something like plot([[0, 1, 2], [3, 4, 5]], [[0, 1], [2, 3]]) will plot column 0 of x vs column 0 of y; column 1 of x vs column 1 of y; and column 2 of x vs column 1 of y (i.e. cycle among columns). This behavior appears to be error-prone to say the least. Note that "normal" broadcasting (1->n) is not deprecated.
1 parent 813d842 commit 2fdfbdf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ def _plot_args(self, tup, kwargs):
391391
func = self._makefill
392392

393393
ncx, ncy = x.shape[1], y.shape[1]
394+
if ncx > 1 and ncy > 1 and ncx != ncy:
395+
cbook.warn_deprecated("2.2", "cycling among columns of inputs "
396+
"with non-matching shapes is deprecated.")
394397
for j in xrange(max(ncx, ncy)):
395398
seg = func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
396399
ret.append(seg)

0 commit comments

Comments
 (0)