Skip to content

Commit f69580e

Browse files
committed
EMH: add ability to return just data from _plot_var_args
1 parent e2cbe8b commit f69580e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/matplotlib/axes/_base.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ class _process_plot_var_args:
214214
"""
215215

216216
def __init__(self, command='plot'):
217+
_api.check_in_list(['plot', 'fill', 'mirror'], command=command)
217218
self.command = command
218219
self.set_prop_cycle(None)
219220

@@ -335,6 +336,11 @@ def _makeline(self, axes, x, y, kw, kwargs):
335336
seg = mlines.Line2D(x, y, **kw)
336337
return seg, kw
337338

339+
def _mirror(self, axes, x, y, kw, kwargs):
340+
kw = {**kw, **kwargs} # Don't modify the original kw.
341+
self._setdefaults(self._getdefaults(kw), kw)
342+
return (x, y), kw
343+
338344
def _makefill(self, axes, x, y, kw, kwargs):
339345
# Polygon doesn't directly support unitized inputs.
340346
x = axes.convert_xunits(x)
@@ -495,9 +501,13 @@ def _plot_args(self, axes, tup, kwargs, *,
495501

496502
if self.command == 'plot':
497503
make_artist = self._makeline
498-
else:
504+
elif self.command == 'fill':
499505
kw['closed'] = kwargs.get('closed', True)
500506
make_artist = self._makefill
507+
elif self.command == 'mirror':
508+
make_artist = self._mirror
509+
else:
510+
_api.check_in_list(['plot', 'fill', 'mirror'], command=self.command)
501511

502512
ncx, ncy = x.shape[1], y.shape[1]
503513
if ncx > 1 and ncy > 1 and ncx != ncy:

0 commit comments

Comments
 (0)