gsplot.AxesDict#

class AxesDict#

Bases: dict[str, Axes]

A dictionary of mosaic Axes supporting both label and integer index access.

Parameters:
  • *args – Dictionary initialization mapping label strings to Matplotlib Axes.

  • **kwargs – Dictionary initialization mapping label strings to Matplotlib Axes.

Notes

Mosaic containers iterate in panel-name (alphabetical) order rather than Matplotlib subplot_mosaic insertion order. "ACE;BDE" therefore iterates as ('A', 'B', 'C', 'D', 'E') even though C and E appear before B and D in the specification. Iteration, integer indexes, slices, and positional value sequences all follow this order, so generated panel indexes and positional label records land on the matching panel letters, while keyed access such as axes["B"] is always exact.

Examples

>>> import gsplot as gs
>>> figure, axes = gs.subplots("AB")
>>> isinstance(axes, gs.AxesDict)
True
>>> axes["A"] is axes[0]
True
>>> figure.clear()

Non-alphabetical mosaics still iterate in panel-name order:

>>> figure, axes = gs.subplots("ACE;BDE")
>>> tuple(axes)
('A', 'B', 'C', 'D', 'E')
>>> axes[1] is axes["B"]
True
>>> figure.clear()
__init__(*args, **kwargs)#

Methods

__class_getitem__

See PEP 585

__init_subclass__

This method is called when a class is subclassed.

__new__(**kwargs)

__subclasshook__

Abstract classes can override this to customize issubclass().

fromkeys([value])

Create a new dictionary with keys from iterable and values set to value.