easyclimate.plot.modplot

Streamline plotting for 2D vector fields

@author: Kieran Hunt https://github.com/kieranmrhunt/curved-quivers/blob/master/modplot.py https://stackoverflow.com/questions/51843313/flow-visualisation-in-python-using-curved-path-following-vectors aligned with matplotlib.streamplot and improved by Jelmer Veenstra (30-03-2023), https://github.com/veenstrajelmer matplotlib.streamplot available at https://raw.githubusercontent.com/matplotlib/matplotlib/main/lib/matplotlib/streamplot.py

Classes

Functions

velovect(axes, x, y, u, v[, density, linewidth, ...])

Draw streamlines of a vector flow.

Module Contents

easyclimate.plot.modplot.velovect(axes, x, y, u, v, density=1, linewidth=None, color=None, cmap=None, norm=None, arrowsize=1, arrowstyle='-|>', transform=None, zorder=None, start_points=None, integration_direction='both', grains=15, broken_streamlines=True, ref_magnitude=None, ref_length=None, min_frac_length=0.0, length_norm='reference', mask_density=10, line_start_stride=1, arrow_stride=1, min_distance=0.0, arrow_head_ratio=1.0, glyph_mode=False, arrow_position=0.8)

Draw streamlines of a vector flow.

Parameters

x, y1D/2D arrays

Evenly spaced strictly increasing arrays to make a grid. If 2D, all rows of x must be equal and all columns of y must be equal; i.e., they must be as if generated by np.meshgrid(x_1d, y_1d).

u, v2D arrays

x and y-velocities. The number of rows and columns must match the length of y and x, respectively.

densityfloat or (float, float)

Controls the closeness of streamlines. When density = 1, the domain is divided into a 30x30 grid. density linearly scales this grid. Each cell in the grid can have, at most, one traversing streamline. For different densities in each direction, use a tuple (density_x, density_y).

linewidthfloat or 2D array

The width of the streamlines. With a 2D array the line width can be varied across the grid. The array must have the same shape as u and v.

colorcolor or 2D array

The streamline color. If given an array, its values are converted to colors using cmap and norm. The array must have the same shape as u and v.

cmap, norm

Data normalization and colormapping parameters for color; only used if color is an array of floats. See ~.Axes.imshow for a detailed description.

arrowsizefloat

Scaling factor for the arrow size.

arrowstylestr

Arrow style specification. See ~matplotlib.patches.FancyArrowPatch.

minlengthfloat

Minimum length of streamline in axes coordinates.

start_points(N, 2) array

Coordinates of starting points for the streamlines in data coordinates (the same coordinates as the x and y arrays).

zorderfloat

The zorder of the streamlines and arrows. Artists with lower zorder values are drawn first.

maxlengthfloat

Maximum length of streamline in axes coordinates.

integration_direction{‘forward’, ‘backward’, ‘both’}, default: ‘both’

Integrate the streamline in forward, backward or both directions.

dataindexable object, optional

DATA_PARAMETER_PLACEHOLDER

broken_streamlinesboolean, default: True

If False, forces streamlines to continue until they leave the plot domain. If True, they may be terminated if they come too close to another streamline.

Returns

CurvedQuiverplotSet

Container object with attributes

  • lines: .LineCollection of streamlines

  • arrows: .PatchCollection containing .FancyArrowPatch objects representing the arrows half-way along streamlines.

    This container will probably change in the future to allow changes to the colormap, alpha, etc. for both lines and arrows, but these changes should be backward compatible.

class easyclimate.plot.modplot.CurvedQuiverplotSet(lines, arrows, resolution, magnitude, speed_max, x_origin, y_origin, width, height, zorder, transform, axes, linewidth, color, cmap, arrowsize, arrowstyle, start_points, integration_direction, grains, broken_streamlines, ref_magnitude, ref_length, min_frac_length, length_norm, mask_density, line_start_stride, arrow_stride, min_distance, arrow_head_ratio, glyph_mode, arrow_position)
lines
arrows
resolution
magnitude
speed_max
x_origin
y_origin
width
height
zorder
transform
axes
linewidth
color
cmap
arrowsize
arrowstyle
start_points
integration_direction
grains
broken_streamlines
ref_magnitude
ref_length
min_frac_length
length_norm
mask_density
line_start_stride
arrow_stride
min_distance
arrow_head_ratio
glyph_mode
arrow_position