ogstools.plot.contourplots module#
Plotting core utilitites.
- ogstools.plot.contourplots.get_ticklabels(ticks)[source]#
Get formatted tick labels and optional offset str.
If all values in ticks are too close together offset notation is used.
- Return type:
tuple[list[str], str | None]
- ogstools.plot.contourplots.add_colorbars(fig, ax, variable, levels, **kwargs)[source]#
Add a colorbar to the matplotlib figure.
- ogstools.plot.contourplots.subplot(mesh, variable, ax, levels=None, **kwargs)[source]#
Plot the variable field of a mesh on a matplotlib.axis.
- ogstools.plot.contourplots.draw_plot(meshes, variable, fig=None, axes=None, **kwargs)[source]#
Plot the variable field of meshes on an existing figure or axis.
- Parameters:
meshes (list[UnstructuredGrid] | ndarray | UnstructuredGrid) – singular mesh or 2D numpy array of meshes
variable (Variable) – the field to be visualized on all meshes
fig (Figure | None) – matplotlib figure to use for plotting
axes (Axes | None) – matplotlib axes to use for plotting
- Return type:
Figure | None
- ogstools.plot.contourplots.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