arundo/adtk

adtk.visualization.plot can't work

Opened this issue · 6 comments

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.

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

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.

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 :)

@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)

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

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