你可以使用发电机(例如:。,
itertools.count
)及
next
:
import matplotlib.pyplot
x=x1=y=(0,0) # dummy data
markers = iter(['r+', 'go--', 'ro'])
plt.figure()
plt.plot(x, next(markers), label='1')
plt.plot(x1, next(markers), label='2')
plt.plot(y, next(markers), label='3')
plt.legend()
输出: