imod.visualize.quiver#
- imod.visualize.quiver(u, v, ax, kwargs_quiver={})[source]#
Wraps matplotlib.quiver to draw quiver plots. Function can be used to draw flow quivers on top of a cross-section.
- Parameters:
u (xr.DataArray) –
Two dimensional DataArray containing u component of quivers. One dimension must be “layer”, and the second dimension will be used as the x-axis for the cross-section.
Coordinates “top” and “bottom” must be present, and must have at least the “layer” dimension (voxels) or both the “layer” and x-coordinate dimension.
Use imod.evaluate.quiver_line() or quiver_linestring() to obtain the required DataArray.
v (xr.DataArray) –
Two dimensional DataArray containing v component of quivers. One dimension must be “layer”, and the second dimension will be used as the x-axis for the cross-section.
Coordinates “top” and “bottom” must be present, and must have at least the “layer” dimension (voxels) or both the “layer” and x-coordinate dimension.
Use imod.evaluate.quiver_line() or quiver_linestring() to obtain the required DataArray.
ax (matplotlib Axes instance) – Axes to write plot to.
kwargs_quiver (dict) – Other optional keyword arguments for matplotlib.quiver.
- Returns:
The drawn quivers.
- Return type:
matplotlib.quiver.Quiver
Examples
First: apply evaluate.quiver_line to get the u and v components of the quivers from a three dimensional flow field. Assign top and bottom coordinates if these are not already present in the flow field data arrays.
>>> u, v = imod.evaluate.quiver_line(right, front, lower, start, end) >>> u.assign_coords(top=top, bottom=bottom) >>> v.assign_coords(top=top, bottom=bottom)
The quivers can then be plotted over a cross section created by imod.visualize.cross_section():
>>> imod.visualize.quiver(u, v, ax)
Quivers can easily overwhelm your plot, so it is a good idea to ‘thin out’ some of the quivers:
>>> # Only plot quivers at every 5th cell and every 3rd layer >>> thin = {"s": slice(0, None, 5), "layer": slice(0, None, 3)} >>> imod.visualize.quiver(u.isel(**thin), v.isel(**thin), ax)