ogstools.plot package#

Plotting utilities for simple access.

ogstools.plot.compute_levels(lower, upper, n_ticks)[source]#

Return an array in the interval [lower, upper] with terminating decimals.

The length of the arrays will be close to n_ticks. At the boundaries the tickspacing may differ from the remaining array.

Return type:

ndarray

ogstools.plot.contourf(meshes, variable, fig=None, ax=None, **kwargs)[source]#

Plot the variable field of meshes with default settings.

The resulting figure adheres to the configurations in plot.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

  • variable (Variable | str) – The field to be visualized on all meshes

  • fig (Figure | None) – matplotlib figure to use for plotting

  • ax (Axes | None) – matplotlib axis to use for plotting

Keyword Arguments:
  • cb_labelsize: colorbar labelsize

  • cb_loc: colorbar location (‘left’ or ‘right’)

  • cb_pad: colorbar padding

  • cmap: colormap

  • dpi: resolution

  • figsize: figure size

  • fontsize size for labels and captions

  • levels: user defined levels

  • log_scaled: logarithmic scaling

  • show_edges: show element edges

  • show_max: mark the location of the maximum value

  • show_min: mark the location of the minimum value

  • show_region_bounds: show the edges of the different regions

  • vmin: minimum value

  • vmax: maximum value

Return type:

Figure | None

ogstools.plot.outline(ax, mesh, style, lw, projection=2)[source]#

Plot the outline of a mesh on a matplotlib ax object.

ogstools.plot.quiver(mesh, ax, variable, projection=None, glyph_type='arrow')[source]#

Plot arrows or lines corresponding to vectors on a matplotlib axis.

Parameters:
  • mesh (DataSet) – Mesh containing the vector variable

  • ax (Axes) – Matplotlib axis to plot onto

  • variable (Vector) – Vector variable to visualize

  • projection (int | None) – Index of flat dimension (e.g. 2 for z axis), gets automatically determined if not given

  • glyph_type (Literal['arrow', 'line']) – Whether to plot arrows or lines.

ogstools.plot.shape_on_top(ax, surf, contour, scaling=1.0)[source]#
ogstools.plot.streamlines(mesh, ax, variable, projection=None)[source]#

Plot the vector streamlines on a matplotlib axis.

Parameters:
  • mesh (DataSet) – Mesh containing the vector variable

  • ax (Axes) – Matplotlib axis to plot onto

  • variable (Vector) – Vector variable to visualize

  • projection (int | None) – Index of flat dimension (e.g. 2 for z axis), gets automatically determined if not given

ogstools.plot.subplot(mesh, variable, ax, levels=None, **kwargs)[source]#

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

Submodules#