plotting_context#

sectionproperties.post.post.plotting_context(ax: matplotlib.axes.Axes | None = None, pause: bool = True, title: str = '', filename: str = '', render: bool = True, axis_index: int | tuple[int, int] | None = None, **kwargs: Any) Generator[tuple[matplotlib.figure.Figure, matplotlib.axes.Axes | Any | None], None, None][source]#

Executes code required to set up a matplotlib figure.

Parameters:
  • ax (matplotlib.axes.Axes | None) – Axes object on which to plot

  • pause (bool) – If set to True, the figure pauses the script until the window is closed. If set to False, the script continues immediately after the window is rendered.

  • title (str) – Plot title

  • filename (str) – Pass a non-empty string or path to save the image as. If this option is used, the figure is closed after the file is saved.

  • render (bool) – If set to False, the image is not displayed. This may be useful if the figure or axes will be embedded or further edited before being displayed.

  • axis_index (int | tuple[int, int] | None) – If more than 1 axis is created by subplot, then this is the axis to plot on. This may be a tuple if a 2D array of plots is returned. The default value of None will select the top left plot.

  • kwargs (Any) – Passed to matplotlib.pyplot.subplots()

Raises:

ValueErroraxis_index is invalid

Yields:

Matplotlib figure and axes

Return type:

Generator[tuple[matplotlib.figure.Figure, matplotlib.axes.Axes | Any | None], None, None]