prophet icon indicating copy to clipboard operation
prophet copied to clipboard

How to save image with plot_components?

Open binoooh opened this issue 9 years ago • 6 comments

I am wondering if I can use plot_components and later save the figures to an image. I tried this

`plt = m.plot_components(forecast)

plt.savefig('output')`

however plot_components returns a list and not a matplotlib figure. Hence the error was thrown...

Traceback (most recent call last): File "get_predictions.py", line 33, in <module> plt.savefig(output_file) AttributeError: 'list' object has no attribute 'savefig'

Any ideas is very much appreciated.

binoooh avatar Mar 28 '17 15:03 binoooh

This is what I use and it works... m.plot_components(forecast).savefig('2.png');

guiled avatar Mar 29 '17 16:03 guiled

Thanks @guiled will try that one.

binoooh avatar Mar 29 '17 16:03 binoooh

Unfortunately that didn't work either p.s. I'm not doing this on a notebook

Traceback (most recent call last): File "get_predictions.py", line 31, in <module> m.plot_components(forecast).savefig(detailed_file) AttributeError: 'list' object has no attribute 'savefig'

binoooh avatar Mar 29 '17 18:03 binoooh

Hello, I have the same problem: m.plot(forecast).savefig('Prophet_Forecast.png'); works all right but m.plot_components(forecast).savefig('Prophet_Components.png'); does not work with the same error as @arvindacumos: AttributeError: 'list' object has no attribute 'savefig' Thanks in advance Stéphane

stephanelebrun avatar Mar 31 '17 12:03 stephanelebrun

@robertdknight thanks can you provide more detailed code?

binoooh avatar Apr 01 '17 17:04 binoooh

how to save image into folder?

akmalsabri avatar Aug 18 '20 08:08 akmalsabri