这是我有史以来的第一个3D图,我不确定如何在x轴上添加日期标签。
%matplotlib notebook
fig = plt.figure()
ax = plt.axes(projection="3d")
ax.plot_wireframe(X, Y, np.transpose(Z), color='red')
ax.set_ylim([0, 30]) #TTM
ax.set_xlim([0, len(x_TradeDate)]) #TradeDates
ax.set_xlabel('TradeDate')
ax.set_ylabel('Time to maturity')
ax.set_zlabel('Spot rate')
plt.show()
我尝试使用ax.xaxis_date
,ax.xaxis.set_ticks
和ax.xaxis.set_ticklabels
,但是它似乎不起作用,或者我根本不知道如何以正确的方式使用命令。 / p>
我的情节看起来像 this。 我想要的是将x轴(TradeDate)标记为日期。现在,x轴就是x-axis values。我在X_TradeDates中有103个日期,我想将这些日期用作标签。我怎么做?如果更易于使用,我还会在列表date中以字符串格式显示日期。
希望我能提供足够的信息,否则请不要犹豫。