mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-09-16 22:20:23 +00:00
Merge pull request #25 from arnesund/configurable-axis-labels
Make plot axis label names configurable
This commit is contained in:
commit
4c9ad937d3
1 changed files with 5 additions and 3 deletions
|
|
@ -618,13 +618,15 @@ class Prophet(object):
|
||||||
|
|
||||||
return pd.DataFrame({'ds': dates})
|
return pd.DataFrame({'ds': dates})
|
||||||
|
|
||||||
def plot(self, fcst, uncertainty=True):
|
def plot(self, fcst, uncertainty=True, xlabel='ds', ylabel='y'):
|
||||||
"""Plot the Prophet forecast.
|
"""Plot the Prophet forecast.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
fcst: pd.DataFrame output of self.predict.
|
fcst: pd.DataFrame output of self.predict.
|
||||||
uncertainty: Optional boolean to plot uncertainty intervals.
|
uncertainty: Optional boolean to plot uncertainty intervals.
|
||||||
|
xlabel: Optional label name on X-axis
|
||||||
|
ylabel: Optional label name on Y-axis
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
|
|
@ -641,8 +643,8 @@ class Prophet(object):
|
||||||
ax.fill_between(fcst['ds'].values, fcst['yhat_lower'],
|
ax.fill_between(fcst['ds'].values, fcst['yhat_lower'],
|
||||||
fcst['yhat_upper'], color=forecast_color, alpha=0.2)
|
fcst['yhat_upper'], color=forecast_color, alpha=0.2)
|
||||||
ax.grid(True, which='major', c='gray', ls='-', lw=1, alpha=0.2)
|
ax.grid(True, which='major', c='gray', ls='-', lw=1, alpha=0.2)
|
||||||
ax.set_xlabel('ds')
|
ax.set_xlabel(xlabel)
|
||||||
ax.set_ylabel('y')
|
ax.set_ylabel(ylabel)
|
||||||
fig.tight_layout()
|
fig.tight_layout()
|
||||||
return fig
|
return fig
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue