I have a simple question regarding matplotlib figure objects.
I have the following code in a function library named gauss that returns a figure:
def plot_3d(X,Y,Z):
fig1 = plt.figure(1)
ax1 = Axes3D(fig1)
surf = ax1.plot_surface(X,Y,Z,cmap=cm.coolwarm)
fig1.colorbar(surf,shrink=0.5,aspect=5)
ax1.set_xlabel('x')
ax1.set_ylabel('y')
ax1.set_zlabel('f(x,y)')
return fig1
In the interpreter, I run the code with a given X,Y,Z
fig = gauss.plot_3d(X,Y,Z)
And the code calls the object. But once I close the object, how can I call it again?
Something along the lines of
plt.show(fig)
?
plt.show(fig)? That works fine for me.Figureinstance through a GUI or otherwise, it's gone.