pyissm.plot.plot
Functions to visualize ISSM Models
Functions
|
Overlay coastline geometries on the model domain. |
|
Overlay contour lines of a scalar field on a triangular mesh. |
|
Overlay coloured or thickness-weighted mesh edges on a plot. |
|
Plot the mesh with element numbers labelled at centroids. |
|
Interpolate a vertex field to a regular grid and display as an image. |
|
Highlight ice-front and grounding-line elements on the mesh. |
|
Plot a 2D triangular mesh using matplotlib. |
|
Plot Dirichlet and Neumann boundary conditions from an ISSM model. |
|
Plot model elements by type (ice, ice-front, ocean, floating, grounded, grounding line) on a 2D mesh. |
|
Plot a 2D scalar field defined on a 2D or 3D model mesh. |
|
Plot model nodes by type (ice, ice-front, ocean, floating, grounded) on a 2D mesh. |
|
Plot time series data from an ISSM model's TransientSolution. |
|
Overlay a GeoTIFF raster image on the model domain. |
|
Draw a quiver (arrow) plot of a 2-D velocity field on the mesh. |
|
Draw streamlines of a 2-D velocity field on the mesh. |
|
Plot the mesh with vertex numbers labelled at each node. |
- pyissm.plot.plot.plot_coastlines(md, ax=None, color='k', linewidth=0.5, resolution='10m', figsize=(6.4, 4.8), constrained_layout=True, **kwargs)
Overlay coastline geometries on the model domain.
Uses cartopy (preferred) when available. Falls back to shapely / Natural Earth shapefiles. If neither is installed a warning is emitted and the axes are returned unchanged.
- Parameters:
md (model) – ISSM model object.
ax (matplotlib.axes.Axes, optional) – Axes to draw on. If None a new figure is created.
color (str) – Coastline colour. Default ‘k’.
linewidth (float) – Coastline line width. Default 0.5.
resolution (str) – Natural Earth resolution: ‘10m’, ‘50m’, or ‘110m’. Default ‘10m’.
figsize (tuple) – Figure size when ax is None. Default (6.4, 4.8).
constrained_layout (bool) – Use constrained layout when creating a new figure. Default True.
- Return type:
(fig, ax) when ax was None, otherwise ax.
- pyissm.plot.plot.plot_contour(md, field, levels=10, ax=None, colors='y', linestyles='-', linewidths=1.0, label=False, label_fmt='%.2f', label_fontsize=10, figsize=(6.4, 4.8), constrained_layout=True, **kwargs)
Overlay contour lines of a scalar field on a triangular mesh.
- Parameters:
md (model) – ISSM model object.
field (array-like, shape (nvertices,) or (nvertices, ntimesteps)) – Scalar field to contour. If 2-D the first time-step is used.
levels (int or array-like) – Number of levels or explicit level values.
ax (matplotlib.axes.Axes, optional) – Axes to draw on. If None a new figure is created.
colors (str or list) – Contour line colour(s). Default ‘y’.
linestyles (str or list) – Contour line style(s). Default ‘-‘.
linewidths (float or list) – Contour line width(s). Default 1.0.
label (bool) – Add inline contour labels. Default False.
label_fmt (str) – Format string for contour labels. Default ‘%.2f’.
label_fontsize (float) – Font size for contour labels. Default 10.
figsize (tuple) – Figure size when ax is None. Default (6.4, 4.8).
constrained_layout (bool) – Use constrained layout when creating a new figure. Default True.
- Return type:
(fig, ax) when ax was None, otherwise ax.
- pyissm.plot.plot.plot_edgeoverlay(md, data, ax=None, edgemin=None, edgetype='thickness', edgeranges=2.0, colormap='jet', figsize=(6.4, 4.8), constrained_layout=True, **kwargs)
Overlay coloured or thickness-weighted mesh edges on a plot.
Requires md.mesh.edges (edge connectivity array).
- Parameters:
md (model) – ISSM model object.
data (array-like, shape (nedges,) or (nvertices,)) – Scalar values to colour / weight the edges. If per-vertex, the edge value is taken as the mean of its two endpoint values.
ax (matplotlib.axes.Axes, optional) – Axes to draw on. If None a new figure is created.
edgemin (float, optional) – Minimum quantile threshold (0–1). Edges below are not drawn. Default 0 (draw all edges).
edgetype (str) – ‘color’ — colour edges by data value (uses ax.quiver colour hack). ‘thickness’ — vary line thickness by data value (default).
edgeranges (float) – Maximum line width or colour magnitude for the thickest/brightest edges. Default 2.
colormap (str or Colormap) – Colormap for ‘thickness’ mode. Default ‘jet’.
figsize (tuple) – Figure size when ax is None. Default (6.4, 4.8).
constrained_layout (bool) – Use constrained layout when creating a new figure. Default True.
- Return type:
(fig, ax) when ax was None, otherwise ax.
- pyissm.plot.plot.plot_elementnumbering(md, ax=None, highlight=None, fontsize=6, figsize=(6.4, 4.8), constrained_layout=True, **kwargs)
Plot the mesh with element numbers labelled at centroids.
- Parameters:
md (model) – ISSM model object.
ax (matplotlib.axes.Axes, optional) – Axes to draw on. If None a new figure is created.
highlight (list of int, optional) – 1-based element indices to highlight in red. Others shown in black.
fontsize (float) – Font size for labels. Default 6.
figsize (tuple) – Figure size when ax is None. Default (6.4, 4.8).
constrained_layout (bool) – Use constrained layout when creating a new figure. Default True.
- Return type:
(fig, ax) when ax was None, otherwise ax.
- pyissm.plot.plot.plot_gridded(md, field, ax=None, xlim=None, ylim=None, posting=None, caxis=None, colormap='viridis', log=False, show_mesh=False, figsize=(6.4, 4.8), constrained_layout=True, **kwargs)
Interpolate a vertex field to a regular grid and display as an image.
Requires scipy.
- Parameters:
md (model) – ISSM model object.
field (array-like, shape (nvertices,) or (nvertices, ntimesteps)) – Scalar field to display. If 2-D the first time-step is used.
ax (matplotlib.axes.Axes, optional) – Axes to draw on. If None a new figure is created.
xlim (array-like [min, max], optional) – Axis limits. Defaults to mesh extent.
ylim (array-like [min, max], optional) – Axis limits. Defaults to mesh extent.
posting (float, optional) – Grid spacing. Defaults to ~300 grid points along the longer axis.
caxis (array-like [vmin, vmax], optional) – Colour axis limits.
colormap (str or Colormap) – Colormap. Default ‘viridis’.
log (bool) – If True apply log10 to data before plotting. Default False.
show_mesh (bool) – If True overlay the mesh edges. Default False.
figsize (tuple) – Figure size when ax is None. Default (6.4, 4.8).
constrained_layout (bool) – Use constrained layout when creating a new figure. Default True.
- Return type:
(fig, ax, im) when ax was None, otherwise (ax, im).
- pyissm.plot.plot.plot_icefront(md, ax=None, ice_color='tab:blue', gl_color='tab:green', alpha=0.6, figsize=(6.4, 4.8), constrained_layout=True, **kwargs)
Highlight ice-front and grounding-line elements on the mesh.
Ice-front elements (elements at the ocean–ice boundary) are coloured ice_color. Grounding-line elements are coloured gl_color.
- Parameters:
md (model) – ISSM model object (must have md.mask.ice_levelset and md.mask.ocean_levelset).
ax (matplotlib.axes.Axes, optional) – Axes to draw on. If None a new figure is created.
ice_color (str) – Colour for ice-front elements. Default ‘tab:blue’.
gl_color (str) – Colour for grounding-line elements. Default ‘tab:green’.
alpha (float) – Alpha transparency. Default 0.6.
figsize (tuple) – Figure size when ax is None. Default (6.4, 4.8).
constrained_layout (bool) – Use constrained layout when creating a new figure. Default True.
- Return type:
(fig, ax) when ax was None, otherwise ax.
- pyissm.plot.plot.plot_mesh2d(md, ax=None, color='k', linewidth=0.1, xlabel='X (m)', ylabel='Y (m)', figsize=(6.4, 4.8), constrained_layout=True, show_nodes=False, node_kwargs={}, **kwargs)
Plot a 2D triangular mesh using matplotlib.
- Parameters:
md (ISSM Model object) – ISSM Model object containing mesh. Must be compatible with process_mesh().
ax (matplotlib.axes.Axes, optional) – An existing matplotlib axes object to plot on. If None, a new figure and axes are created.
color (str, optional) – Color of the triangle edges. Default is ‘k’ (black).
linewidth (float, optional) – Width of the triangle edges. Default is 0.1.
xlabel (str, optional) – Label for the x-axis. Default is ‘X (m)’.
ylabel (str, optional) – Label for the y-axis. Default is ‘Y (m)’.
figsize (tuple of float, optional) – Figure size in inches if a new figure is created. Default is (6.4, 4.8).
constrained_layout (bool, optional) – Whether to use constrained layout when creating a new figure. Default is ‘True’.
show_nodes (bool, optional) – If True, overlay nodes on the mesh using ax.scatter(). Default is ‘False’.
node_kwargs (dict, optional) – Keyword arguments passed to ax.scatter() for node display. Defaults to {‘marker’: ‘.’, ‘color’: ‘k’, ‘s’: 5}.
**kwargs – Additional keyword arguments passed to ax.triplot().
- Returns:
If ‘ax’ is None, returns ‘(fig, ax)’ of the created figure and axes. If ‘ax’ is provided, returns the modified ‘ax’.
- Return type:
matplotlib.figure.Figure or matplotlib.axes.Axes
Example
fig, ax = plot_mesh2d(md) fig, ax = plot_mesh2d(md, color = ‘blue’, linewidth = 0.5) fig, (ax1, ax2) = plt.subplots(1, 2) ax1 = plot_mesh2d(md, ax = ax1) ax2 = plot_mesh2d(md, ax = ax2, show_nodes = True, node_kwargs = {‘color’: ‘red’})
- pyissm.plot.plot.plot_model_bc(md, type='stressbalance', ax=None, layer=None, scale=10, xlabel='X (m)', ylabel='Y (m)', figsize=(6.4, 4.8), constrained_layout=True, show_mesh=True, mesh_kwargs={}, show_legend=True, legend_kwargs={})
Plot Dirichlet and Neumann boundary conditions from an ISSM model.
This function visualizes boundary conditions for a specified model component (e.g., stressbalance, masstransport, thermal, etc.) on a 2D or 3D mesh. Dirichlet conditions are plotted as colored markers, and Neumann boundaries (e.g. ice-front) plotted as coloured elements.
- Parameters:
md (ISSM Model object) – ISSM Model object containing mesh. Must be compatible with process_mesh()
type (str, optional) – The boundary condition type to plot. Must be one of: ‘stressbalance’, ‘masstransport’, ‘thermal’, ‘balancethickness’, ‘hydrology’, ‘debris’, or ‘levelset’. Default is ‘stressbalance’.
ax (matplotlib.axes.Axes, optional) – Existing matplotlib Axes object. If not provided, a new figure and axes are created.
layer (int, optional) – Index of the horizontal layer to extract for 3D models (1-based indexing). Ignored for 2D models. If not provided, the surface layer is used by default.
scale (float, optional) – Scaling factor for Dirichlet marker sizes. Default is 10.
figsize (tuple of float, optional) – Size of the figure in inches (width, height). Default is (6.4, 4.8).
constrained_layout (bool, optional) – Whether to use constrained layout for figure spacing. Default is True.
show_mesh (bool, optional) – Whether to display the model mesh beneath boundary markers. Default is True.
mesh_kwargs (dict, optional) – Additional keyword arguments passed to the mesh plotting function. Overrides default {‘alpha’: 0.5}.
show_legend (bool, optional) – Whether to display a legend showing boundary condition types. Default is True.
legend_kwargs (dict, optional) – Additional keyword arguments passed to ax.legend(). Overrides default {‘title’: ‘Boundary condition’, ‘fontsize’: 10, ‘loc’: ‘upper right’}.
- Returns:
fig (matplotlib.figure.Figure) – The matplotlib Figure object (only returned if ax is not provided).
ax (matplotlib.axes.Axes) – The matplotlib Axes object containing the plot.
Notes
For 3D models, only surface boundary conditions are plotted.
Neumann (ice-front) elements are included by default as blue elements.
If no constraints are found for a given boundary condition, a message is printed and nothing is plotted for that type.
Examples
fig, ax = plot_model_bc(md) fig, ax = plot_model_bc(md, scale = 1) fig, ax = plot_model_bc(md, type=’thermal’, mesh_kwargs = {‘color’: ‘grey’}, legend_kwargs = {‘title’: ‘Model BCs’})
See also
plot_model_elementsUsed internally to visualize Neumann conditions and mesh.
- pyissm.plot.plot.plot_model_elements(md, ice_levelset, ocean_levelset, type='ice_elements', ax=None, color='blue', xlabel='X (m)', ylabel='Y (m)', figsize=(6.4, 4.8), constrained_layout=True, show_mesh=True, mesh_kwargs={}, show_legend=True, legend_kwargs={})
Plot model elements by type (ice, ice-front, ocean, floating, grounded, grounding line) on a 2D mesh.
This function uses level set fields to classify mesh elements and visualize them in a triplot visualisation. Optionally overlays the finite element mesh and includes a custom legend. Supports plotting in existing Matplotlib axes or creating a new figure.
- Parameters:
md (ISSM Model object) – ISSM Model object containing mesh. Must be compatible with process_mesh().
ice_levelset (ndarray) – Array of ice level set values. Negative values indicate ice-covered nodes; zero indicates the ice front.
ocean_levelset (ndarray) – Array of ocean level set values. Negative values indicate ocean-covered nodes.
type ({'ice_elements', 'ice_front_elements', 'ocean_elements', 'floating_ice_elements',) – ‘grounded_ice_elements’, ‘grounding_line_elements’}, optional The element type to visualize. Default is ‘ice_elements’.
ax (matplotlib.axes.Axes, optional) – Axes object to draw on. If None, a new figure and axes are created.
color (str, optional) – Color used for elements. Default is “blue”.
figsize (tuple of float, optional) – Size of the figure in inches (width, height). Default is (6.4, 4.8).
constrained_layout (bool, optional) – Whether to use constrained layout in figure. Default is True.
show_mesh (bool, optional) – Whether to overlay the triangular mesh. Default is True.
mesh_kwargs (dict, optional) – Additional keyword arguments passed to plot_mesh2d() for customizing mesh appearance.
show_legend (bool, optional) – Whether to display a legend identifying node types. Default is True.
legend_kwargs (dict, optional) – Additional keyword arguments passed to ax.legend().
- Returns:
If ‘ax’ is None, returns a tuple (fig, ax) with the created figure and axes. If ‘ax’ is provided, returns the updated axes.
- Return type:
matplotlib.figure.Figure or matplotlib.axes.Axes
Example
fig, ax = plot_model_elements(md, md.mask.ice_levelset, md.mask.ocean_levelset) fig, ax = plot_model_elements(md, md.mask.ice_levelset, md.mask.ocean_levelset, show_mesh = False) fig, ax = plot_model_elements(md, md.mask.ice_levelset, md.mask.ocean_levelset, type = ‘ice_front_elements’, mesh_kwargs = {‘linewidth’: 0.5, ‘color’: ‘cyan’}) fig, ax = plot_model_elements(md, md.mask.ice_levelset, md.mask.ocean_levelset, type = ‘floating_ice_elements’, color = ‘red’)
- pyissm.plot.plot.plot_model_field(md, field, layer=None, ax=None, depth_average=False, plot_data_on='points', xlabel='X (m)', ylabel='Y (m)', edgecolors='face', figsize=(6.4, 4.8), log=False, constrained_layout=True, show_mesh=False, show_cbar=False, mesh_kwargs={}, cbar_kwargs={}, colormap=None, **kwargs)
Plot a 2D scalar field defined on a 2D or 3D model mesh.
This function visualizes a field defined on the mesh of an ISSM model. It works both 2D and 3D meshes by extracting a layer from 3D models. If no layer is specified for a 3D model, the surface values are plotted by default.
- Parameters:
md (ISSM Model object) – ISSM Model object containing mesh. Must be compatible with process_mesh()
field (np.ndarray) – A 1D array representing the scalar field to plot. Must be defined on vertices or elements. For 3D models, may be defined across all layers.
layer (int, optional) – Index of the horizontal layer to extract for 3D models (1-based indexing). Ignored for 2D models. If not provided, the surface layer is used by default for vertex- and element-based 3D fields.
ax (matplotlib.axes.Axes, optional) – An existing matplotlib Axes object to plot on. If None, a new figure and axes are created.
depth_average (bool, optional) – If True and the model is 3D, the field is depth-averaged before plotting. Cannot be True if layer is specified. Default is False.
plot_data_on (str, optional) – Should data be plotted on points or elements? Default is ‘points’. These options are converted to ‘shading’ used by plt.tripcolor(), as follows: plot_data_on = ‘points’: shading = ‘gouraud’ / plot_data_on = ‘elements’: shading = ‘flat’. When data are defined on elements, plot_data_on = ‘elements’ is selected automatically internally.
xlabel (str, optional) – Label for the x-axis. Default is ‘X (m)’.
ylabel (str, optional) – Label for the y-axis. Default is ‘Y (m)’.
edgecolors (str, optional) – Color of triangle edges in the plot. Passed to ‘tripcolor’. Default is ‘face’.
figsize (tuple, optional) – Figure size in inches when creating a new figure. Default is (6.4, 4.8).
log (bool, optional) – If True, applies a logarithmic color normalization. Default is ‘False’.
constrained_layout (bool, optional) – Whether to use constrained layout for the figure. Default is ‘True’.
show_mesh (bool, optional) – If True, overlays the 2D mesh lines on the plot. Default is ‘False’.
show_cbar (bool, optional) – If True, adds a colorbar to the plot. Default is ‘False’.
mesh_kwargs (dict, optional) – Keyword arguments passed to the mesh plotting function ‘plot_mesh2d()’.
cbar_kwargs (dict, optional) – Keyword arguments passed to ‘fig.colorbar’.
**kwargs (dict, optional) – Additional keyword arguments passed to ‘ax.tripcolor’.
- Returns:
If ‘ax’ is not provided, returns a tuple ‘(fig, ax)’. If ‘ax’ is provided, returns only ‘ax’.
- Return type:
matplotlib.figure.Figure or matplotlib.axes.Axes
Example
fig, ax = plot_model_field(md, md.inversion.vel_obs) fig, ax = plot_model_field(md, md.results.TransientSolution.Vel[0], log = True) fig, ax = plot_model_field(md, md.results.TransientSolution.Temperature[-1], layer = 3) fig, ax = plot_model_field(md, md.results.TransientSolution.Temperature[-1], layer = 3, show_cbar = True, show_mesh = True)
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, constrained_layout = True) ax1 = plot_model_field(md, md.inversion.vel_obs, ax = ax1, log = True, cmap = ‘viridis’) ax2 = plot_model_field(md, md.results.StressbalanceSolution.Vel, ax = ax2, log = True, cmap = ‘viridis’) ax3 = issm.plot.plot_model_field(md, md.inversion.vel_obs - md.results.StressbalanceSolution.Vel, ax=ax3, cmap=’RdBu’, show_cbar = True) ax1.set_title(‘Observed Velocities’); ax2.set_title(‘Modelled Velocities’); ax3.set_title(‘Velocity Error’)
- pyissm.plot.plot.plot_model_nodes(md, ice_levelset, ocean_levelset, type='ice_nodes', ax=None, s=5, colors=['r', 'k'], marker='o', xlabel='X (m)', ylabel='Y (m)', figsize=(6.4, 4.8), constrained_layout=True, show_mesh=True, mesh_kwargs={}, show_legend=True, legend_kwargs={})
Plot model nodes by type (ice, ice-front, ocean, floating, grounded) on a 2D mesh.
This function uses level set fields to classify mesh nodes and visualize them in a scatter plot. Optionally overlays the finite element mesh and includes a custom legend. Supports plotting in existing Matplotlib axes or creating a new figure.
- Parameters:
md (ISSM Model object) – ISSM Model object containing mesh. Must be compatible with process_mesh().
ice_levelset (ndarray) – Array of ice level set values. Negative values indicate ice-covered nodes; zero indicates the ice front.
ocean_levelset (ndarray) – Array of ocean level set values. Negative values indicate ocean-covered nodes.
type ({'ice_nodes', 'ice_front_nodes', 'ocean_nodes', 'floating_ice_nodes', 'grounded_ice_nodes'}, optional) – The node type to visualize. Default is ‘ice_nodes’.
ax (matplotlib.axes.Axes, optional) – Axes object to draw on. If None, a new figure and axes are created.
s (float, optional) – Marker size for scatter plot. Default is 5.
colors (list of str, optional) – Colors used for binary classification. First color is for “False”, second for “True”. Default is [‘r’, ‘k’].
marker (str, optional) – Marker style for nodes. Default is ‘o’.
figsize (tuple of float, optional) – Size of the figure in inches (width, height). Default is (6.4, 4.8).
constrained_layout (bool, optional) – Whether to use constrained layout in figure. Default is True.
show_mesh (bool, optional) – Whether to overlay the triangular mesh. Default is True.
mesh_kwargs (dict, optional) – Additional keyword arguments passed to plot_mesh2d() for customizing mesh appearance.
show_legend (bool, optional) – Whether to display a legend identifying node types. Default is True.
legend_kwargs (dict, optional) – Additional keyword arguments passed to ax.legend().
- Returns:
If ‘ax’ is None, returns a tuple (fig, ax) with the created figure and axes. If ‘ax’ is provided, returns the updated axes.
- Return type:
matplotlib.figure.Figure or matplotlib.axes.Axes
Example
fig, ax = plot_model_nodes(md, md.mask.ice_levelset, md.mask.ocean_levelset) fig, ax = plot_model_nodes(md, md.mask.ice_levelset, md.mask.ocean_levelset, show_mesh = False) fig, ax = plot_model_nodes(md, md.mask.ice_levelset, md.mask.ocean_levelset, type = ‘ice_front_nodes’, mesh_kwargs = {‘linewidth’: 0.5, ‘color’: ‘cyan’}) fig, ax = plot_model_nodes(md, md.mask.ice_levelset, md.mask.ocean_levelset, type = ‘floating_ice_nodes’, colors = [‘blue’, ‘magenta’])
- pyissm.plot.plot.plot_model_ts(md, data_list=None, variable_list=None, unit_list=None, time=(0, inf), xlabel='Time (years)', figsize=(6.4, 4.8), fontsize=8, color='black', show_grid=True, constrained_layout=True, sharex=True, **kwargs)
Plot time series data from an ISSM model’s TransientSolution.
Automatically extracts 1D time series arrays from md.results.TransientSolution if data_list is not provided. Plots each variable as a separate subplot, sharing the x-axis (time).
- Parameters:
md (object) – ISSM model object containing results with a TransientSolution attribute.
data_list (list of np.ndarray, optional) – List of 1D numpy arrays to plot. If None, all 1D arrays in md.results.TransientSolution (except ‘time’ and ‘step’) are used.
variable_list (list of str, optional) – List of variable names corresponding to data_list. If None, names are auto-generated or extracted from TransientSolution.
unit_list (list of str, optional) – List of units for each variable. If None, defaults to ‘Units unspecified’ or ‘ISSM Units’.
time (tuple of float, optional) – Time range (start, end) to plot. Defaults to (0, np.inf).
figsize (tuple of int, optional) – Figure size in inches. Defaults to (6.4, 4.8).
fontsize (int, optional) – Font size for labels and titles. Defaults to 8.
color (str, optional) – Line color for plots. Defaults to ‘black’.
show_grid (bool, optional) – Whether to show grid lines on plots. Defaults to True.
constrained_layout (bool, optional) – Whether to use matplotlib’s constrained layout. Defaults to True.
sharex (bool, optional) – Whether subplots share the x-axis. Defaults to True.
- Returns:
fig (matplotlib.figure.Figure) – The matplotlib figure object containing the plots.
axs (np.ndarray of matplotlib.axes.Axes) – Array of axes objects for each subplot.
- Raises:
ValueError – If no time array is found, no 1D time series are available, input lists are mismatched, or data arrays are not 1D.
Examples
>>> fig, axs = plot_model_ts(md) >>> fig, axs = plot_model_ts(md, data_list=[arr1, arr2], variable_list=['Var1', 'Var2'], unit_list=['m', 'kg'])
- pyissm.plot.plot.plot_overlay(md, geotiff_path, ax=None, xlim=None, ylim=None, overlaylims=None, greyscale=True, alpha=1.0, figsize=(6.4, 4.8), constrained_layout=True, **kwargs)
Overlay a GeoTIFF raster image on the model domain.
Requires osgeo.gdal.
- Parameters:
md (model) – ISSM model object (used for default xlim/ylim from mesh extent).
geotiff_path (str) – Path to the GeoTIFF file.
ax (matplotlib.axes.Axes, optional) – Axes to draw on. If None a new figure is created.
xlim (array-like [min, max], optional) – Domain extent in model coordinates. Defaults to mesh extent.
ylim (array-like [min, max], optional) – Domain extent in model coordinates. Defaults to mesh extent.
overlaylims (array-like [min, max], optional) – Intensity clipping limits for greyscale images.
greyscale (bool) – Convert to greyscale. Default True.
alpha (float) – Transparency of the overlay. Default 1.0.
figsize (tuple) – Figure size when ax is None. Default (6.4, 4.8).
constrained_layout (bool) – Use constrained layout when creating a new figure. Default True.
- Return type:
(fig, ax) when ax was None, otherwise ax.
- pyissm.plot.plot.plot_quiver(md, vx=None, vy=None, ax=None, color='k', scale=None, width=0.005, headwidth=6.0, headlength=None, normalize=False, figsize=(6.4, 4.8), constrained_layout=True, **kwargs)
Draw a quiver (arrow) plot of a 2-D velocity field on the mesh.
- Parameters:
md (model) – ISSM model object.
vx (array-like, shape (nvertices,), optional) – X / Y velocity components. Defaults to md.initialization.vx / vy.
vy (array-like, shape (nvertices,), optional) – X / Y velocity components. Defaults to md.initialization.vx / vy.
ax (matplotlib.axes.Axes, optional) – Axes to draw on. If None a new figure is created.
color (str or array-like) – Arrow colour or ‘speed’ to colour by velocity magnitude.
scale (float, optional) – Scaling factor for arrows. Auto-computed from domain size if None.
width (float) – Arrow shaft width in axes fraction. Default 5e-3.
headwidth (float) – Head width relative to shaft. Default 6.
headlength (float, optional) – Head length. Defaults to headwidth * 1.5.
normalize (bool) – If True all arrows have equal length (unit vectors). Default False.
figsize (tuple) – Figure size when ax is None. Default (6.4, 4.8).
constrained_layout (bool) – Use constrained layout when creating a new figure. Default True.
- Return type:
(fig, ax) when ax was None, otherwise ax.
- pyissm.plot.plot.plot_streamlines(md, vx=None, vy=None, ax=None, grid_n=200, color='k', linewidth=1.0, density=1.0, arrowsize=1.0, speed_scale=False, speed_scale_factor=1.0, figsize=(6.4, 4.8), constrained_layout=True, **kwargs)
Draw streamlines of a 2-D velocity field on the mesh.
Requires scipy.
- Parameters:
md (model) – ISSM model object.
vx (array-like, shape (nvertices,), optional) – X / Y velocity components. Defaults to md.initialization.vx / vy.
vy (array-like, shape (nvertices,), optional) – X / Y velocity components. Defaults to md.initialization.vx / vy.
ax (matplotlib.axes.Axes, optional) – Axes to draw on. If None a new figure is created.
grid_n (int) – Resolution of the regular grid for streamplot. Default 200.
color (str) – Streamline colour. Default ‘k’.
linewidth (float or array-like) – Streamline width. Default 1.0. Set to None to auto-scale by speed when speed_scale is True.
density (float) – Streamline density passed to
ax.streamplot. Default 1.0.arrowsize (float) – Arrow size multiplier. Default 1.0.
speed_scale (bool) – If True, scale linewidth by speed magnitude. Default False.
speed_scale_factor (float) – Multiplier for speed-scaled linewidths. Default 1.0.
figsize (tuple) – Figure size when ax is None. Default (6.4, 4.8).
constrained_layout (bool) – Use constrained layout when creating a new figure. Default True.
- Return type:
(fig, ax) when ax was None, otherwise ax.
- pyissm.plot.plot.plot_vertexnumbering(md, ax=None, highlight=None, fontsize=6, figsize=(6.4, 4.8), constrained_layout=True, **kwargs)
Plot the mesh with vertex numbers labelled at each node.
- Parameters:
md (model) – ISSM model object.
ax (matplotlib.axes.Axes, optional) – Axes to draw on. If None a new figure is created.
highlight (list of int, optional) – 1-based vertex indices to highlight in red. Others shown in white.
fontsize (float) – Font size for labels. Default 6.
figsize (tuple) – Figure size when ax is None. Default (6.4, 4.8).
constrained_layout (bool) – Use constrained layout when creating a new figure. Default True.
- Return type:
(fig, ax) when ax was None, otherwise ax.