ogstools.meshplotlib package#

meshplotlib utilities for simple access.

ogstools.meshplotlib.plot(meshes, mesh_property, fig=None, ax=None)[source]#

Plot the property field of meshes with default settings.

The resulting figure adheres to the configurations in meshplotlib.setup. For 2D, the whole domain, for 3D a set of slices is displayed.

Parameters:
  • meshes (list[UnstructuredGrid] | ndarray | UnstructuredGrid) – Singular mesh of 2D numpy array of meshes

  • property – The property field to be visualized on all meshes

  • fig (Figure | None) – Matplotlib Figure object to use for plotting (optional)

  • ax (Axes | None) – Matplotlib Axis object to use for plotting (optional)

  • mesh_property (Property | str)

Return type:

Figure | None

ogstools.meshplotlib.plot_contour(ax, mesh, style, lw, projection=2)[source]#
Parameters:
  • ax (Axes)

  • mesh (DataSet)

  • style (str)

  • lw (int)

  • projection (int)

Return type:

None

ogstools.meshplotlib.plot_on_top(ax, surf, contour, scaling=1.0)[source]#
Parameters:
  • ax (Axes)

  • surf (DataSet)

  • contour (Callable[[ndarray], ndarray])

  • scaling (float)

Return type:

None

ogstools.meshplotlib.plot_probe(mesh_series, points, mesh_property, mesh_property_abscissa=None, labels=None, time_unit='s', interp_method=None, interp_backend_pvd=None, colors=None, linestyles=None, ax=None, fill_between=False, **kwargs)[source]#

Plot the transient property on the observation points in the MeshSeries.

param mesh_series:

MeshSeries object containing the data to be plotted.

param points:

The points to sample at.

param mesh_property:

The property to be sampled.

param labels:

The labels for each observation point.

param time_unit:

Output unit of the timevalues.

param interp_method:

Choose the interpolation method, defaults to linear for xdmf MeshSeries and probefilter for pvd MeshSeries.

param interp_backend:

Interpolation backend for PVD MeshSeries.

param kwargs:

Keyword arguments passed to matplotlib’s plot function.

returns:

A matplotlib Figure

Parameters:
  • mesh_series (MeshSeries)

  • points (ndarray)

  • mesh_property (Property | str)

  • mesh_property_abscissa (Property | str | None)

  • labels (list[str] | None)

  • time_unit (str | None)

  • interp_method (Literal['nearest', 'linear', 'probefilter'] | None)

  • interp_backend_pvd (Literal['vtk', 'scipy'] | None)

  • colors (list | None)

  • linestyles (list | None)

  • ax (Axes | None)

  • fill_between (bool)

  • kwargs (Any)

Return type:

Figure | None

ogstools.meshplotlib.subplot(mesh, mesh_property, ax, levels=None)[source]#

Plot the property field of a mesh on a matplotlib.axis.

In 3D the mesh gets sliced according to slice_type and the origin in the PlotSetup in meshplotlib.setup. Custom levels and a colormap string can be provided.

Parameters:
  • mesh (UnstructuredGrid)

  • mesh_property (Property | str)

  • ax (Axes)

  • levels (ndarray | None)

Return type:

None

ogstools.meshplotlib.update_font_sizes(fig, fontsize=20)[source]#

Update font sizes of lebels and ticks in all subplots

Parameters:
  • fig (Figure) – Matplotlib Figure object to use for plotting

  • int – New font size for the labels and ticks (optional)

  • fontsize (int)

Return type:

Figure

ogstools.meshplotlib.label_spatial_axes(axes, x_label='x', y_label='y')[source]#

Add labels to x and y axis.

If given an array of axes, only the outer axes will be labeled.

Parameters:
  • axes (Axes | ndarray)

  • x_label (str)

  • y_label (str)

Return type:

None

ogstools.meshplotlib.clear_labels(axes)[source]#
Parameters:

axes (Axes | ndarray)

Return type:

None

Submodules#