Skip to content

Commit 3ad0f0a

Browse files
committed
BUG: use style parameter in tsplots, close #1338
1 parent 3b4dcf1 commit 3ad0f0a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pandas/tools/plotting.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,8 @@ def _make_ts_plot(self, data, **kwargs):
528528
ax = self.ax
529529

530530
label = com._stringify(self.label)
531-
tsplot(data, plotf, ax=ax, label=label, **kwargs)
531+
tsplot(data, plotf, ax=ax, label=label, style=self.style,
532+
**kwargs)
532533
ax.grid(self.grid)
533534
else:
534535
for i, col in enumerate(data.columns):

pandas/tseries/plotting.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ def tsplot(series, plotf, *args, **kwargs):
9999

100100
series = series.dropna()
101101

102+
style = kwargs.pop('style', None)
103+
102104
if 'ax' in kwargs:
103105
ax = kwargs.pop('ax')
104106
else:
@@ -114,7 +116,7 @@ def tsplot(series, plotf, *args, **kwargs):
114116
ax.date_axis_info = None
115117

116118
# format args and lot
117-
args = _check_plot_params(series, series.index, freq, *args)
119+
args = _check_plot_params(series, series.index, freq, style, *args)
118120
plotted = plotf(ax, *args, **kwargs)
119121

120122
format_dateaxis(ax, ax.freq)
@@ -149,7 +151,7 @@ def get_datevalue(date, freq):
149151

150152
# Check and format plotting parameters
151153

152-
def _check_plot_params(series, xdata, freq, *args):
154+
def _check_plot_params(series, xdata, freq, style, *args):
153155
"""
154156
Defines the plot coordinates (and basic plotting arguments).
155157
"""
@@ -160,7 +162,10 @@ def _check_plot_params(series, xdata, freq, *args):
160162
if len(args) == 0:
161163
if xdata is None:
162164
raise ValueError(noinfo_msg)
163-
return (xdata, series)
165+
if style is not None:
166+
return (xdata, series, style)
167+
else:
168+
return (xdata, series)
164169

165170
output = []
166171
while len(remaining) > 0:

0 commit comments

Comments
 (0)