graphinglib.SmartFigure.__getitem__#
- SmartFigure.__getitem__(key: int | slice | tuple[int | slice]) SmartFigure[source]#
Gives the child SmartFigure at the specified key in the SmartFigure. This can be used to modify or extract directly a child figure in a SmartFigure used as a layout. The indexing follows classical 2D numpy-like indexing, where the first element corresponds to the row and the second element corresponds to the column.
- Parameters:
- keyint | slice | tuple[int | slice]
The key specifying the location(s) in the SmartFigure to access. If a tuple of ints is provided, the child figure is accessed in the corresponding square of the grid, following classical 2D numpy-like indexing. If slices are provided, a child figure spanning multiple squares in the grid can be retrieved. If
num_rowsornum_colsis set to 1, the key can be a single int or slice to index into the single row or column. Otherwise, the key must be a two-tuple.Note
If a child figure spans multiple cells, you can access it by indexing any cell it occupies. For example, if a child figure spans
[0, :](entire first row), you can access it viafig[0, :],fig[0, 0], orfig[0, 1](assuming there are at least 2 columns). If the requested slice overlaps with multiple different child figures, a GraphingException is raised. SmartFigures used as a single plot do not support subplot indexing.
- Returns:
- SmartFigure
The child SmartFigure at the specified key.