dynamo.pl.plot_flow_field¶
- dynamo.pl.plot_flow_field(vecfld, x_range, y_range, n_grid=100, start_points=None, integration_direction='both', background=None, density=1, linewidth=1, streamline_color=None, streamline_alpha=0.4, color_start_points=None, save_show_or_return='return', save_kwargs={}, ax=None, **streamline_kwargs)[source]¶
Plots the flow field with line thickness proportional to speed.
Code adapted from: http://be150.caltech.edu/2017/handouts/dynamical_systems_approaches.html
- Parameters:
vecfld (
Topography2D) – an instance of the vector_field class.x_range (
Union[_SupportsArray[dtype[Any]],_NestedSequence[_SupportsArray[dtype[Any]]],bool,int,float,complex,str,bytes,_NestedSequence[Union[bool,int,float,complex,str,bytes]]]) – the range of values for x-axis.y_range (
Union[_SupportsArray[dtype[Any]],_NestedSequence[_SupportsArray[dtype[Any]]],bool,int,float,complex,str,bytes,_NestedSequence[Union[bool,int,float,complex,str,bytes]]]) – the range of values for y-axis.n_grid (
int(default:100)) – the number of grid points to use in computing derivatives on phase portrait. Defaults to 100.start_points (
Optional[ndarray] (default:None)) – the initial points from which the streamline will be drawn. Defaults to None.integration_direction (
Literal['forward','backward','both'] (default:'both')) – integrate the streamline in forward, backward or both directions. default is ‘both’. Defaults to “both”.background (
Optional[str] (default:None)) – the background color of the plot. Defaults to None.density (
float(default:1)) – the density of the plt.streamplot function. Defaults to 1.linewidth (
float(default:1)) – the multiplier of automatically calculated linewidth passed to the plt.streamplot function. Defaults to 1.streamline_color (
Optional[str] (default:None)) – the color of the vector field streamlines. Defaults to None.streamline_alpha (
float(default:0.4)) – the alpha value applied to the vector field streamlines. Defaults to 0.4.color_start_points (
Optional[float] (default:None)) – the color of the starting point that will be used to predict cell fates. Defaults to None.save_show_or_return (
Literal['save','show','return'] (default:'return')) – whether to save, show or return the figure. Defaults to “return”.save_kwargs (
Dict[str,Any] (default:{})) – a dictionary that will be passed to the save_show_ret function. By default, it is an empty dictionary and the save_show_ret function will use the {“path”: None, “prefix”: ‘plot_flow_field’, “dpi”: None, “ext”: ‘pdf’, “transparent”: True, “close”: True, “verbose”: True} as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs. Defaults to {}.ax (
Optional[Axes] (default:None)) – the Axis on which to make the plot. Defaults to None.
- Return type:
- Returns:
None would be returned by default. If save_show_or_return is set to be ‘return’, the Axes of the generated figure would be returned.