dynamo.pl.plot_traj

dynamo.pl.plot_traj(f, y0, t, args=(), lw=2, background=None, integration_direction='both', save_show_or_return='return', save_kwargs={}, ax=None)[source]

Plots a trajectory on a phase portrait. code adapted from: http://be150.caltech.edu/2017/handouts/dynamical_systems_approaches.html

Parameters
  • f (function for form f(y, t, *args)) – The right-hand-side of the dynamical system. Must return a 2-array.

  • y0 (array_like, shape (2,)) – Initial condition.

  • t (array_like) – Time points for trajectory.

  • args (tuple, default ()) – Additional arguments to be passed to f

  • lw (float, (default: 2)) – The line width of the trajectory.

  • background (str or None (default: None)) – The background color of the plot.

  • integration_direction (str (default: forward)) – Integrate the trajectory in forward, backward or both directions. default is ‘both’.

  • save_show_or_return ({‘show’, ‘save’, ‘return’} (default: return)) – Whether to save, show or return the figure.

  • save_kwargs (dict (default: {})) – A dictionary that will passed to the save_fig function. By default it is an empty dictionary and the save_fig function will use the {“path”: None, “prefix”: ‘plot_traj’, “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.

  • ax (Matplotlib Axis instance) – Axis on which to make the plot

Returns

output – Axis with streamplot included.

Return type

Matplotlib Axis instance