在3D绘图中的x轴上添加日期标签(python)
这是我有史以来的第一个3D绘图,我不确定如何将日期标签添加到我的x轴在3D绘图中的x轴上添加日期标签(python),python,matplotlib,mplot3d,Python,Matplotlib,Mplot3d,这是我有史以来的第一个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('T
%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\u date
、ax.xaxis.set\u ticks
和ax.xaxis.set\u ticklebels
,但似乎不起作用,或者我根本不知道如何正确使用这些命令
我的情节看起来像
.
我想要的是将x轴(TradeDate)标记为日期。现在x轴只是。我有103个日期,我想用这些日期作为标签。我该怎么做?我也有一个列表中的字符串格式的日期,如果它更容易使用的话
我希望我已经提供了足够的信息,否则请不要犹豫询问