I am new to python
and pyplot
. I am trying to understand the documentation for the Matplotlib API related to the Figure Figure API.
In the beginning it says there is a class matplotlib.figure.AxesStack
, and then
The AxesStack is a callable, where ax_stack() returns the current axes
When I try to use this in a program
import numpy as np
import matplotlib.pyplot as plt
n=4
v=np.arange(n)
X,Y = np.meshgrid(v,v)
Z=np.random.rand(n-1,n-1)
fig, ax = plt.subplots()
plt.pcolormesh(X, Y, Z)
plt.axis('tight')
plt.colorbar()
ast=fig.ax_stack()
plt.show()
I get error
AttributeError: 'Figure' object has no attribute 'ax_stack'
question from:
https://stackoverflow.com/questions/24104990/how-to-get-a-list-of-axes-for-a-figure-in-pyplot 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…