我设法使用此代码:
%env DISPLAY=:20
import matplotlib.pyplot as plt
plt.switch_backend('Qt5Agg')
# %pylab
import numpy as np
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)
plt.xlabel('time (s)')
plt.ylabel('voltage (mV)')
plt.title('About as simple as it gets, folks')
plt.grid(True)
plt.savefig("test.png")
plt.show()
(在交互模式下打开带有图形的窗口)
但没有pandas代码:
%env DISPLAY=:20
import matplotlib.pyplot as plt
import pandas as pd
plt.switch_backend('Qt5Agg')
pd.Series(10,index=list(range(0,10))).plot()
我错过了什么?