Prophet: charts in my_model.plot and model.plot_components is duplicated

Created on 30 Oct 2017  路  1Comment  路  Source: facebook/prophet

Firstly, thank you for your works.

And, I have a problem that charts in my_model.plot and model.plot_components is duplicated as below.

How can I fix it?

Thanks.

dup

dup2

Most helpful comment

If this is in a notebook, then it is because of Jupyter behavior that displays any plot that is generated, but then also prints the return value of the last line in the cell (if not assigned). In this case, m.plot() returns a matplotlib figure, and so jupyter is printing the figure a second time.

You can get around this by either assigning the output of plot, e.g. like fig = m.plot(). Or, in the notebook you can also suppress the printing of the last line by ending it with a semicolon, like m.plot();. You'll notice in our documentation that the plot lines have semicolons after them exactly for this reason.

>All comments

If this is in a notebook, then it is because of Jupyter behavior that displays any plot that is generated, but then also prints the return value of the last line in the cell (if not assigned). In this case, m.plot() returns a matplotlib figure, and so jupyter is printing the figure a second time.

You can get around this by either assigning the output of plot, e.g. like fig = m.plot(). Or, in the notebook you can also suppress the printing of the last line by ending it with a semicolon, like m.plot();. You'll notice in our documentation that the plot lines have semicolons after them exactly for this reason.

Was this page helpful?
0 / 5 - 0 ratings