Multiple calls to .plot(): colors not correctly cycled · Issue #8242 · pandas-dev/pandas (original) (raw)

Versions:
Pandas 0.14.1
Matplotlib: 1.4.0

Reproduce:
Run:

import matplotlib.pyplot as plt import numpy as np import pandas as pd

for i in range(20): pd.Series(np.random.rand(20)).plot(label=i) plt.legend()

Output:
index
You can see that the colors are cycled once and then only blue (i.e. the first color) is being used.

Expected output:
index2
You can see that colors are being cycled correctly.

The expected output was produced using matplotlib's plot() command. But note that if Series.plot() was run once in the interpreter, matplotlib's plot() command produces the same errenous behavior (only plotting blue after the first cycle). It thus appears that Series.plot() sets some global matplotlib state that causes this.