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], _NestedSequence[_SupportsArray[dtype]], 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], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) – the range of values for y-axis.

  • n_grid (int) – the number of grid points to use in computing derivatives on phase portrait. Defaults to 100.

  • start_points (Optional[ndarray]) – the initial points from which the streamline will be drawn. Defaults to None.

  • integration_direction (Literal['forward', 'backward', 'both']) – integrate the streamline in forward, backward or both directions. default is ‘both’. Defaults to “both”.

  • background (Optional[str]) – the background color of the plot. Defaults to None.

  • density (float) – the density of the plt.streamplot function. Defaults to 1.

  • linewidth (float) – the multiplier of automatically calculated linewidth passed to the plt.streamplot function. Defaults to 1.

  • streamline_color (Optional[str]) – the color of the vector field streamlines. Defaults to None.

  • streamline_alpha (float) – the alpha value applied to the vector field streamlines. Defaults to 0.4.

  • color_start_points (Optional[float]) – 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']) – whether to save, show or return the figure. Defaults to “return”.

  • save_kwargs (Dict[str, Any]) – 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]) – the Axis on which to make the plot. Defaults to None.

Return type:

Optional[Axes]

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.