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
Streamfrom 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.5to3.- line_widthfloat
Width of the stream lines. Default depends on the
figure_styleconfiguration. Typical range is0.5to3points.- colorstr
Color of the stream lines. Default depends on the
figure_styleconfiguration.- color_mapstr or Colormap
Color map of the stream lines. Default depends on the
figure_styleconfiguration. Examples include"viridis","plasma", and"coolwarm".- arrow_sizefloat
Arrow size multiplier. Default depends on the
figure_styleconfiguration. Typical range is0.5to3.
- Returns:
- A
Streamobject from a function.
- A
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 between0and1((0, 0, 1)or(0, 0, 1, 0.5)). They may also be arrays of intensity values, which are mapped throughcolor_map.