Håkon Hægland
Håkon Hægland

Reputation: 40758

How do I get a list of axes for a figure in pyplot?

Regarding matplotlib.figure, the documentation says there is a class matplotlib.figure.AxesStack and that

The AxesStack is a callable, where ax_stack() returns the current axes

However, when I call fig.ax_stack(), I get the error:

AttributeError: 'Figure' object has no attribute 'ax_stack'

Upvotes: 65

Views: 130528

Answers (1)

tacaswell
tacaswell

Reputation: 87376

The property .axes returns a list of the Axes objects in the Figure object:

ax_list = fig.axes

Upvotes: 103

Related Questions