phase_portrait

Contents

phase_portrait#

class braintools.visualize.phase_portrait(x, y=None, dx=None, dy=None, trajectory=True, vector_field=False, ax=None, figsize=(8, 8), cmap='viridis', alpha=0.7, title=None, **kwargs)#

Create a phase portrait plot for dynamical systems.

Parameters:
  • x (ndarray) – State variables. If y is None, assumes x is 2D with (x, y) columns.

  • y (ndarray | None) – State variables. If y is None, assumes x is 2D with (x, y) columns.

  • dx (ndarray | None) – Derivatives for vector field.

  • dy (ndarray | None) – Derivatives for vector field.

  • trajectory (bool) – Whether to show trajectory.

  • vector_field (bool) – Whether to show vector field.

  • ax (Axes | None) – Axes to plot on.

  • figsize (Tuple[float, float]) – Figure size if creating new figure.

  • cmap (str) – Colormap for trajectory.

  • alpha (float) – Alpha transparency.

  • title (str | None) – Plot title.

  • **kwargs – Additional arguments passed to plot.

Returns:

ax – The axes object containing the plot.

Return type:

Axes