@@ -1503,39 +1503,25 @@ def plot(self, xs, ys, *args, **kwargs):
1503
1503
Other arguments are passed on to
1504
1504
:func:`~matplotlib.axes.Axes.plot`
1505
1505
'''
1506
- # FIXME: This argument parsing might be better handled
1507
- # when we set later versions of python for
1508
- # minimum requirements. Currently at 2.4.
1509
- # Note that some of the reason for the current difficulty
1510
- # is caused by the fact that we want to insert a new
1511
- # (semi-optional) positional argument 'Z' right before
1512
- # many other traditional positional arguments occur
1513
- # such as the color, linestyle and/or marker.
1514
1506
had_data = self .has_data ()
1515
- zs = kwargs .pop ('zs' , 0 )
1516
- zdir = kwargs .pop ('zdir' , 'z' )
1517
1507
1518
- argsi = 0
1519
- # First argument is array of zs
1520
- if args and cbook .iterable (args [0 ]) and len (xs ) == len (args [0 ]):
1521
- # So, we know that it is an array with
1522
- # first dimension the same as xs.
1523
- # Next, check to see if the data contained
1524
- # therein (if any) is scalar (and not another array).
1525
- if len (args [0 ]) == 0 or cbook .is_scalar (args [0 ][0 ]):
1526
- zs = args [argsi ]
1527
- argsi += 1
1528
-
1529
- # First argument is z value
1530
- elif args and cbook .is_scalar (args [0 ]):
1531
- zs = args [argsi ]
1532
- argsi += 1
1508
+ # `zs` can be passed positionally or as keyword; checking with
1509
+ # `_is_string_like` matches the behavior of 2D `plot` (via
1510
+ # `_process_plot_var_args`).
1511
+ if args and not cbook .is_string_like (args [0 ]):
1512
+ zs = args [0 ]
1513
+ args = args [1 :]
1514
+ if 'zs' in kwargs :
1515
+ raise TypeError ("plot() for multiple values for argument 'z'" )
1516
+ else :
1517
+ zs = kwargs .pop ('zs' , 0 )
1518
+ zdir = kwargs .pop ('zdir' , 'z' )
1533
1519
1534
1520
# Match length
1535
1521
if not cbook .iterable (zs ):
1536
1522
zs = np .ones (len (xs )) * zs
1537
1523
1538
- lines = Axes .plot (self , xs , ys , * args [ argsi :] , ** kwargs )
1524
+ lines = Axes .plot (self , xs , ys , * args , ** kwargs )
1539
1525
for line in lines :
1540
1526
art3d .line_2d_to_3d (line , zs = zs , zdir = zdir )
1541
1527
0 commit comments