Prophet: Can I adjust the output plot range?

Created on 22 Apr 2020  路  1Comment  路  Source: facebook/prophet

I predicted one month with five years of data, but the predicted area is too narrow to see.
So I want to see only the last 1 year or the last 6 months, not 5 years.

How Can I do so?
plot

Most helpful comment

If you do

fig = m.plot(fcst)

then fig is a matplotlib fig object and matplotlib gives you complete control over making changes to it. For any change you want to make to a figure, just search for how to do that in matplotlib and you can almost certainly find a SO post about it. In this case, do ax = fig.gca() to get the matplotlib axis object, and then ax.set_xlim([lower, upper]) to change the limit. lower and upper here would be python datetime objects with the dates you want for the lower and upper limits.

>All comments

If you do

fig = m.plot(fcst)

then fig is a matplotlib fig object and matplotlib gives you complete control over making changes to it. For any change you want to make to a figure, just search for how to do that in matplotlib and you can almost certainly find a SO post about it. In this case, do ax = fig.gca() to get the matplotlib axis object, and then ax.set_xlim([lower, upper]) to change the limit. lower and upper here would be python datetime objects with the dates you want for the lower and upper limits.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robertdknight picture robertdknight  路  3Comments

sriramkraju picture sriramkraju  路  3Comments

andmib picture andmib  路  3Comments

ChaymaeHarfoush picture ChaymaeHarfoush  路  3Comments

arnaudvl picture arnaudvl  路  3Comments