Skip to content

Commit

Permalink
BUG: axes.color_cycle from mpl rcParams should not be joined as singl…
Browse files Browse the repository at this point in the history
…e string
  • Loading branch information
changhiskhan committed Nov 14, 2012
1 parent bf538a9 commit e374f0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions pandas/tests/test_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,21 @@ def test_line_colors(self):
plt.close('all')
df.ix[:, [0]].plot(color='DodgerBlue')

@slow
def test_default_color_cycle(self):
import matplotlib.pyplot as plt
plt.rcParams['axes.color_cycle'] = list('rgbk')

plt.close('all')
df = DataFrame(np.random.randn(5, 3))
ax = df.plot()

lines = ax.get_lines()
for i, l in enumerate(lines):
xp = plt.rcParams['axes.color_cycle'][i]
rs = l.get_color()
self.assert_(xp == rs)


class TestDataFrameGroupByPlots(unittest.TestCase):

Expand Down
4 changes: 3 additions & 1 deletion pandas/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,9 @@ def _use_dynamic_x(self):

def _get_colors(self):
import matplotlib.pyplot as plt
cycle = ''.join(plt.rcParams.get('axes.color_cycle', list('bgrcmyk')))
cycle = plt.rcParams.get('axes.color_cycle', list('bgrcmyk'))
if isinstance(cycle, basestring):
cycle = list(cycle)
has_colors = 'color' in self.kwds
colors = self.kwds.get('color', cycle)
return colors
Expand Down

0 comments on commit e374f0f

Please sign in to comment.