arundo/adtk

How to save the figure for the plotting result?

isunix opened this issue · 1 comments

How to save the figure for the plotting result?

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:
earthgecko@895c517

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.