From: T J <tj...@gm...> - 2012-10-16 22:36:32
|
There seems to be an issue with how arguments are parsed when it comes to determining the color of a line. Generally, it seems that 'c' takes precedence over 'color'. However, this precedence seems to change with the number of passed kwargs. ------------- import matplotlib.pyplot as plt import numpy as np # 'c' seems to have precedence over 'color' plt.plot(np.arange(10)-2, c='b', color='r') # line is blue plt.plot(np.arange(10)-1, color='r', c='b') # line is blue # But... x = {'c': 'b', 'color': 'r', 'label': 'blah', 'linestyle': '-', 'linewidth': 3, 'marker': None} # Some strange parsing error plt.plot(np.arange(10)+1, **x) # line is red del x['marker'] # delete any key but 'c' or 'color' plt.plot(np.arange(10)+2, **x) # line is blue x['zorder'] = 3 # add back any key plt.plot(np.arange(10)+3, **x) # line is red plt.show() |