我在处理绘图时遇到了问题,因为在我处理它时,轴标签似乎显示在 Jupyter Notebooks 中。
但是,当我将文件导出到 .py 文件并在终端中运行它时,给出的图表没有轴标签。
fig = plt.figure(figsize = (15,5))
ax = fig.add_axes([0,0,1,1])
ax.set_title('Oil vs Banks Mean Return')
ax.set_xlabel('Date')
ax.set_ylabel('Price')
ax.plot(all_returns['Mean'], label = 'Banks Mean', color = 'green')
ax.plot(all_returns['Oil'], label = 'Oil', color = 'black')
ax.plot(movavg['Mean'], label = 'Mean MA', color = 'blue')
ax.plot(movavg['Oil'], label = 'OIL MA', color = 'red')
ax.legend()
plt.tight_layout();
在 Jupyter Notebooks 中,它显示轴和标签,例如。年份等:
但是,当我导出它时,它们不见了:
DIEA
守候你守候我
相关分类