Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix positional argument parsing

  • Loading branch information...
commit db493b5c24769d701f68531cba4971c36743429d 1 parent 6c02993
@dmcdougall dmcdougall authored
Showing with 16 additions and 4 deletions.
  1. +16 −4 lib/matplotlib/axes.py
View
20 lib/matplotlib/axes.py
@@ -5108,20 +5108,32 @@ def stem(self, *args, **kwargs):
# Assume there's at least one data array
y = np.asarray(args[0], dtype=np.float)
+ args = args[1:]
# Try a second one
try:
- second = np.asarray(args[1], dtype=np.float)
+ second = np.asarray(args[0], dtype=np.float)
x, y = y, second
+ args = args[1:]
except:
# The second array doesn't make sense, or it doesn't exist
second = np.arange(len(y))
x = second
# Popping some defaults
- linefmt = kwargs.pop('linefmt', 'b-')
- markerfmt = kwargs.pop('markerfmt', 'bo')
- basefmt = kwargs.pop('basefmt', 'r-')
+ try:
+ linefmt = kwargs.pop('linefmt', args[0])
+ except IndexError:
+ linefmt = kwargs.pop('linefmt', 'b-')
+ try:
+ markerfmt = kwargs.pop('markerfmt', args[1])
+ except IndexError:
+ markerfmt = kwargs.pop('markerfmt', 'bo')
+ try:
+ basefmt = kwargs.pop('basefmt', args[2])
+ except IndexError:
+ basefmt = kwargs.pop('basefmt', 'r-')
+
bottom = kwargs.pop('bottom', None)
label = kwargs.pop('label', None)
Please sign in to comment.
Something went wrong with that request. Please try again.