Skip to content

Commit b8b2746

Browse files
committed
fixed color keyword in time series plot - issue pandas-dev#1890
1 parent a1cd25f commit b8b2746

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

pandas/tests/test_graphics.py

+10
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,16 @@ def test_series_plot_color_kwargs(self):
489489
line = ax.get_lines()[0]
490490
self.assert_(line.get_color() == 'green')
491491

492+
@slow
493+
def test_time_series_plot_color_kwargs(self):
494+
# #1890
495+
import matplotlib.pyplot as plt
496+
497+
plt.close('all')
498+
ax = Series(np.arange(12) + 1, index=date_range('1/1/2000', periods=12)).plot(color='green')
499+
line = ax.get_lines()[0]
500+
self.assert_(line.get_color() == 'green')
501+
492502
PNG_PATH = 'tmp.png'
493503

494504
def _check_plot_works(f, *args, **kwargs):

pandas/tools/plotting.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,8 @@ def _make_ts_plot(self, data, **kwargs):
936936

937937
def _maybe_add_color(kwargs, style, i):
938938
if (not has_colors and
939-
(style is None or re.match('[a-z]+', style) is None)):
939+
(style is None or re.match('[a-z]+', style) is None)
940+
and 'color' not in kwargs):
940941
kwargs['color'] = colors[i % len(colors)]
941942

942943
def to_leg_label(label, i):

0 commit comments

Comments
 (0)