adtk icon indicating copy to clipboard operation
adtk copied to clipboard

How to save the figure for the plotting result?

Open isunix opened this issue 4 years ago • 1 comments

How to save the figure for the plotting result?

isunix avatar Jun 23 '21 02:06 isunix

Hi @isunix

From one user to another. I wanted to do the same.

I have a fork with that single change that allows the plot to be save as an image: https://github.com/earthgecko/adtk/commit/895c517927d8eebbd37db9a82f772285d6a9e68e

This change simply adds the save_to_file parameter to plot function in the _visualization.py.

save_to_file: str, optional
    The full path and filename where to save the plot as a png image.
    Default: "".

To save a plot to file simply call plot with the save_to_file parameter set:

save_to_file = '/tmp/plot-image.png'
title = 'my adtk graph'
plot(s, anomaly=anomaly_df, anomaly_color='red', title=title, save_to_file=save_to_file)

If you want to install the fork (take care to use the appropriate pip version for your environment):

git clone https://github.com/earthgecko/adtk.git
cd adtk/
git checkout develop
pip install ./

I am only responding as there is very little activity on this project, hence I did not go to the trouble of pull requesting this change as there seemed to be little point.

earthgecko avatar Jul 18 '21 06:07 earthgecko