plotting_context#
- planestress.post.plotting.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. Defaults to
None
.pause (bool) – If set to
True
, the figure pauses the script until the window is closed. If set toFalse
, the script continues immediately after the window is rendered. Defaults toTrue
.title (str) – Plot title. Defaults to
""
.filename (str) – Pass a non-empty string or path to save the image. If this option is used, the figure is closed after the file is saved. Defaults to
""
.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. Defaults toTrue
.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:
ValueError –
axis_index
is invalid- Yields:
Matplotlib figure and axes
- Return type:
Generator[tuple[matplotlib.figure.Figure, matplotlib.axes.Axes | Any | None], None, None]