Series markers in pandas dataframe plots

Robert Sim :

I'm plotting a pandas dataframe which contains multiple time series. I have more series than the number of colors matplotlib chooses from, so there is ambiguity in mapping legend colors to plots.
I haven't seen any matplotlib examples that assigns markers as a batch across all series and I'm wondering if there's a way to pass a list of marker styles that df.plot() can rotate through in the same way it chooses colors.

df.plot(markers = ??)

Quang Hoang :

A for loop would be sufficient:

df = pd.DataFrame(np.arange(16).reshape(4,-1))

for c,m in zip(df,'oxds'):
    df[c].plot(marker=m)

plt.legend()

Output:

enter image description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=237773&siteId=1