graphinglib.VectorField#

class graphinglib.VectorField(x_data: ArrayLike, y_data: ArrayLike, u_data: ArrayLike, v_data: ArrayLike, arrow_width: float | Inherit = Inherit, arrow_head_size: float | Inherit = Inherit, scale: float | None = None, make_angles_axes_independent: bool = False, color: str | Inherit = Inherit)[source]#

This class implements vector fields.

Parameters:
x_data, y_dataArrayLike

x and y coordinates of the vectors.

u_data, v_dataArrayLike

Magnitudes in the x and y coordinates.

arrow_widthfloat

Width of the arrow shaft. Acts as a multiplier for the standard arrow width. Typical range is 0.5 to 4. Default depends on the figure_style configuration.

arrow_head_sizefloat

Size of the arrow head. Acts as a multiplier for the standard arrow head size. Typical range is 0.5 to 4. Default depends on the figure_style configuration.

scalefloat

Scaling of the arrow lengths. If None, the arrows will be automatically scaled to look nice. Use 1 for no scaling.

angle_in_data_coordsbool

Whether to use the screen coordinates or the data coordinates to determine the vector directions. Defaults to True.

colorstr

Color of the vector arrows. Default depends on the figure_style configuration.

Notes

Color parameters accept Matplotlib color formats: named colors ("blue"), short color strings ("b"), hex strings ("#0000ff"), grayscale strings ("0.5"), and RGB/RGBA tuples with values between 0 and 1 ((0, 0, 1) or (0, 0, 1, 0.5)).

Methods

__init__(x_data, y_data, u_data, v_data[, ...])

This class implements vector fields.

copy()

Returns a deep copy of the VectorField.

copy_with(**kwargs)

Returns a deep copy of the Plottable with specified attributes overridden.

from_function(func, x_axis_range, y_axis_range)

Creates a VectorField from a function.