So I am trying to plot a 3d chart using mplot3d with matplotlib. Code as following:
# generate the graph
# vols is a 2D array indexed by [maturity, strike].
def DrawGraph(self, strikes, maturities, vols):
import matplotlib.dates as dates
import matplotlib.pyplot as pyplot
# prepare data
Y = dates.date2num(maturities)
X, Y = numpy.meshgrid(strikes, Y)
# plot
fig = pyplot.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_wireframe(X, Y, vols)
pyplot.show()
Where maturities and strikes are 1D arrays, and vols is a 2D array with proper size. Everything runs proper and all data are valid. However, I got a totally blank window with nothing but gray background.
Anyone can give me some hints of what's going on? I suspect the version of matplotlib isn't right but not sure how to check it.
Thanks in advance.