Linestyle in matplotlib step function
问题 Is it possible to set the linestyle in a matplotlib step function to dashed, dotted, etc.? I've tried: step(x, linestyle='--'), step(x, '--') But it did not help. 回答1: As of mpl 1.3.0 this is fixed upstream You have to come at it a bit sideways as step seems to ignore linestyle . If you look at what step is doing underneath, it is just a thin wrapper for plot. You can do what you want by talking to plot directly: import matplotlib.pyplot as plt plt.plot(range(5), range(5), linestyle='--',