matplotlib.figure.AxesStack

class matplotlib.figure.AxesStack [source]

Bases: matplotlib.cbook.Stack

Specialization of the Stack to handle all tracking of Axes in a Figure. This stack stores key, (ind, axes) pairs, where:

  • key should be a hash of the args and kwargs used in generating the Axes.
  • ind is a serial number for tracking the order in which axes were added.

The AxesStack is a callable, where ax_stack() returns the current axes. Alternatively the current_key_axes() will return the current key and associated axes.

add(key, a) [source]

Add Axes a, with key key, to the stack, and return the stack.

If key is unhashable, replace it by a unique, arbitrary object.

If a is already on the stack, don't add it again, but return None.

as_list() [source]

Return a list of the Axes instances that have been added to the figure.

bubble(a) [source]

Move the given axes, which must already exist in the stack, to the top.

current_key_axes() [source]

Return a tuple of (key, axes) for the active axes.

If no axes exists on the stack, then returns (None, None).

get(key) [source]

Return the Axes instance that was added with key. If it is not present, return None.

remove(a) [source]

Remove the axes from the stack.

© 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.0.0/api/_as_gen/matplotlib.figure.AxesStack.html