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.line(mesh, var1=None, var2=None, ax=None, **kwargs)[source]#
Plot some data of a (1D) mesh.
You can pass “x”, “y” or “z” to either of x_var or y_var to specify which spatial dimension should be used for the corresponding axis. You can also pass two data variables for a phase plot. if no value is given, automatic detection of spatial axis is tried.
>>> line(mesh) # z=const: y over x, y=const: z over x, x=const: z over y >>> line(mesh, ot.variables.temperature) # temperature over x, y or z >>> line(mesh, "y", "temperature") # temperature over y >>> line(mesh, ot.variables.pressure, "y") # y over pressure >>> line(mesh, "pressure", "temperature") # temperature over pressure
- Parameters:
mesh (DataSet) – The mesh which contains the data to plot
var1 (str | Variable | None) – Variable for the x-axis if var2 is given else for y-axis.
var2 (str | Variable | None) – Variable for the y-axis if var1 is given.
ax (Axes | None) – The matplotlib axis to use for plotting, if None a new figure will be created.
- Keyword Arguments:
figsize: figure size (default=[16, 10])
color: color of the line
linewidth: width of the line
linestyle: style of the line
label: label in the legend
grid: if True, show grid
all other kwargs get passed to matplotlib’s plot function
- Return type:
Figure | None
- 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.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#
- ogstools.plot.contourplots module
- ogstools.plot.features module
- ogstools.plot.levels module
- ogstools.plot.lineplots module
- ogstools.plot.plot_setup module
PlotSetup
PlotSetup.combined_colorbar
PlotSetup.custom_cmap
PlotSetup.dpi
PlotSetup.min_ax_aspect
PlotSetup.max_ax_aspect
PlotSetup.invert_colorbar
PlotSetup.layout
PlotSetup.material_names
PlotSetup.num_levels
PlotSetup.num_streamline_interp_pts
PlotSetup.vmax
PlotSetup.vmin
PlotSetup.__init__()
PlotSetup.show_element_edges
PlotSetup.log_scaled
PlotSetup.show_region_bounds
PlotSetup.tick_pad
PlotSetup.tick_length
PlotSetup.fontsize
PlotSetup.linewidth
PlotSetup.label_split
PlotSetup.spatial_unit
PlotSetup.time_unit
PlotSetup.from_dict()
PlotSetup.reset()
PlotSetup.set_units()
- ogstools.plot.plot_setup_defaults module
- ogstools.plot.shared module
- ogstools.plot.utils module
- ogstools.plot.vectorplots module