I am currently trying to plot several date graphs using the matplotlibs This gives me a nice shape with 3 lines in them but they all have the same color May include. Changing the call to So my question is whether there is no way to color to work with A good way to solve this problem came up: By default, and the user can overwrite this by passing the argument By doing so, the result will be: plot_date function I am One thing I did not understand is how to assign a different color to each article automatically (as with
plot axes.color_cycle setting
matplotlib .rcParams ). Example Code: import import matplotlib.pyplot as mpt import matplotlib.dates mdates value = xrange (1, 13) dates = [Dt import matlotlib as dt import time as datetime Import] i [i, 1, i, 0, 0, 0] for i in ['axes.color_cycle'] = ['r', 'g']: i for i (0, 1, 2) Mpl.rcParams: nv = map (lambda k: k + i, value) d = mdates.date2num (dates) plt.plot_date (d, nv, ls = "solid") plt.show ()
plot_date in just three lines in red and green on
plot , but unfortunately the X axis labels are no longer useful.
plot_date , just as it is just
plot Does it for
TCSWell explained that this function is set to
fmt = 'bo'; ax.plot_date (d, nv, ls = 'solid', fmt = '')
fmt while calling
plot_date () .
No comments:
Post a Comment