arundo / adtk

A Python toolkit for rule-based/unsupervised anomaly detection in time series
https://adtk.readthedocs.io
Mozilla Public License 2.0
1.06k stars 143 forks source link

adtk.visualization.plot can't work #111

Open MorpheusPoi opened 3 years ago

MorpheusPoi commented 3 years ago

Hello,

I am new learner to ADTK and trying to run sample codes bellow:

import pandas as pd from adtk.visualization import plot from adtk.data import validate_series

df = pd.read_csv("E:/Codes/python/Book1.csv", index_col="TestTime", parse_dates=True, squeeze=True) GP1_train = df["GP1"] GP1_train = validate_series(GP1_train) print(GP1_train) plot(GP1_train)

I thought it will pop out a graph but there is no graph after the code exicuted without any error reported. I am not sure what is the problem and hopes anyone can help on this issue. Thanks very much for your help.

tailaiw commented 3 years ago

Are your running this in jupyter notebook? If so, you may need %matplotlib inline.

MorpheusPoi commented 3 years ago

Are your running this in jupyter notebook? If so, you may need %matplotlib inline.

Thanks for your help. I tried VS code and PyCharm and both failed to present a chart. Also I tried in other computer but still can't get a chart. Also I tried to use matplotlib to plot a chart and it can generate a chart as expect.

sbriseid commented 3 years ago

I experienced the same issue, running from the terminal. I resolved it by adding a call to pyplot show after my adtk plots. ... import matplotlib.pyplot as plt ... plt.show() ... I am new to adtk, not sure if this was an intended change. But I actually prefer to be able to decide when to show my plots :)

tailaiw commented 3 years ago

@sbriseid That's exactly the design :) The plot function returns matplotlib figure and axes objects and users may decide when and how to show plots by themselves (e.g. plt.show() or %matplotlib inline in notebook)

MorpheusPoi commented 3 years ago

@sbriseid your method works. @tailaiw, @sbriseid, thanks very much for your help.

JohnRothan commented 1 year ago

today i meet the same problem,and @sbriseid help me resolve it quickly,thanks