Я строю диаграмму области с линейным графиком в виде подкладки поверх структуры информационного кадра, как показано ниже:
df = pd.DataFrame({'Date':pd.date_range('2018-1-1', periods=100, freq='D'),'Pre1':np.random.randint(-1000, 1000, 100),
'Pre2':np.random.randint(-750, 1000, 100)},
columns=['Date','Pre1','Pre2'])
df=df.set_index('Date')
и
DatetimeIndex(['2017-01-01', '2017-01-03', '2017-01-04', '2017-01-05',
'2017-01-06', '2017-01-09', '2017-01-10', '2017-01-11',
'2017-01-12', '2017-01-13',
...
'2018-08-29', '2018-08-30', '2018-08-31', '2018-09-03',
'2018-09-04', '2018-09-05', '2018-09-06', '2018-09-07',
'2018-09-10', '2018-09-11'],
dtype='datetime64[ns]', name='Date', length=416, freq=None)
Я использую
plt.figure()
ax3=df.plot(df.index,'Pre1', color="g",linewidth=0.8) #the line
plt.fill_between(df.index,df['Pre1'], facecolor="palegreen", alpha=0.4) # the area
ax3.tick_params(axis="x",direction="in")
ax3.tick_params(axis="y",direction="in")
plt.text(1,100,'Pre')
plt.text(3,-100,'Dis')
plt.ylabel('$')
ax3.legend().set_visible(False)
plt.title('This is a test')
plt.xticks()
ax3.yaxis.grid(True,linestyle='--')
plt.show()
Однако я получил ошибку ниже:
ValueError: Image size of 362976x273 pixels is too large. It must be less than 2^16 in each direction.
Я попытался перезапустить ядро так же, как и Jupyter, но безуспешно.Также попробовал figsize = (6,8), не работает.Кто-нибудь знает в чем проблема?