graphinglib.Stream.from_function#

classmethod Stream.from_function(func: Callable[[TypeAliasForwardRef('ArrayLike'), TypeAliasForwardRef('ArrayLike')], tuple[TypeAliasForwardRef('ArrayLike'), TypeAliasForwardRef('ArrayLike')]], x_axis_range: tuple[float, float], y_axis_range: tuple[float, float], number_of_points_x: int = 30, number_of_points_y: int = 30, density: float | tuple[float, float] = 1, line_width: float | Inherit = Inherit, color: str | Inherit = Inherit, color_map: str | Colormap | Inherit = Inherit, arrow_size: float | Inherit = Inherit) Self[source]#

Creates a Stream from a function.

Parameters:
funcCallable[[ArrayLike, ArrayLike], [ArrayLike, ArrayLike]]

Function to be plotted. Works with regular functions and lambda functions.

x_axis_range, y_axis_rangetuple[float, float], optional

The range of x and y values used for the axes as tuples containing the start and end of the range.

number_of_points_x, number_of_points_yint

Number of points to fill the x and y ranges. Defaults to 30.

densityfloat or tuple[float, float]

Density of stream lines. Can be specified independently for the x and y coordinates by specifying a density tuple instead. Defaults to 1. Typical range is 0.5 to 3.

line_widthfloat

Width of the stream lines. Default depends on the figure_style configuration. Typical range is 0.5 to 3 points.

colorstr

Color of the stream lines. Default depends on the figure_style configuration.

color_mapstr or Colormap

Color map of the stream lines. Default depends on the figure_style configuration. Examples include "viridis", "plasma", and "coolwarm".

arrow_sizefloat

Arrow size multiplier. Default depends on the figure_style configuration. Typical range is 0.5 to 3.

Returns:
A Stream object from a function.

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)). They may also be arrays of intensity values, which are mapped through color_map.