control.phase_plane_plot
- control.phase_plane_plot(sys, pointdata=None, timedata=None, gridtype=None, gridspec=None, plot_streamlines=None, plot_vectorfield=None, plot_streamplot=None, plot_equilpoints=True, plot_separatrices=True, ax=None, suppress_warnings=False, title=None, **kwargs)[source]
Plot phase plane diagram.
This function plots phase plane data, including vector fields, stream lines, equilibrium points, and contour curves. If none of plot_streamlines, plot_vectorfield, or plot_streamplot are set, then plot_streamplot is used by default.
- Parameters:
- sys
NonlinearIOSystemor callable(t, x, …) I/O system or function used to generate phase plane data. If a function is given, the remaining arguments are drawn from the
paramskeyword.- pointdatalist or 2D array
List of the form [xmin, xmax, ymin, ymax] describing the boundaries of the phase plot or an array of shape (N, 2) giving points of at which to plot the vector field.
- timedataint or list of int
Time to simulate each streamline. If a list is given, a different time can be used for each initial condition in
pointdata.- gridtypestr, optional
The type of grid to use for generating initial conditions: ‘meshgrid’ (default) generates a mesh of initial conditions within the specified boundaries, ‘boxgrid’ generates initial conditions along the edges of the boundary, ‘circlegrid’ generates a circle of initial conditions around each point in point data.
- gridspeclist, optional
If the gridtype is ‘meshgrid’ and ‘boxgrid’,
gridspecgives the size of the grid in the x and y axes on which to generate points. If gridtype is ‘circlegrid’, thengridspecis a 2-tuple specifying the radius and number of points around each point in thepointdataarray.- paramsdict, optional
Parameters to pass to system. For an I/O system,
paramsshould be a dict of parameters and values. For a callable,paramsshould be dict with key ‘args’ and value given by a tuple (passed to callable).- colormatplotlib color spec, optional
Plot all elements in the given color (use
plot_<element>= {‘color’: c} to set the color in one element of the phase plot (equilpoints, separatrices, streamlines, etc).- ax
matplotlib.axes.Axes, optional The matplotlib axes to draw the figure on. If not specified and the current figure has a single axes, that axes is used. Otherwise, a new figure is created.
- sys
- Returns:
- cplt
ControlPlotobject Object containing the data that were plotted. See
ControlPlotfor more detailed information.- cplt.linesarray of list of
matplotlib.lines.Line2D Array of list of
matplotlib.artist.Artistobjects:lines[0] = list of Line2D objects (streamlines, separatrices).
lines[1] = Quiver object (vector field arrows).
lines[2] = list of Line2D objects (equilibrium points).
lines[3] = StreamplotSet object (lines with arrows).
- cplt.axes2D array of
matplotlib.axes.Axes Axes for each subplot.
- cplt.figure
matplotlib.figure.Figure Figure containing the plot.
- cplt
- Other Parameters:
- arrowsint
Set the number of arrows to plot along the streamlines. The default value can be set in
config.defaults['phaseplot.arrows'].- arrow_sizefloat
Set the size of arrows to plot along the streamlines. The default value can be set in
config.defaults['phaseplot.arrow_size'].- arrow_stylematplotlib patch
Set the style of arrows to plot along the streamlines. The default value can be set in
config.defaults['phaseplot.arrow_style'].- dirstr, optional
Direction to draw streamlines: ‘forward’ to flow forward in time from the reference points, ‘reverse’ to flow backward in time, or ‘both’ to flow both forward and backward. The amount of time to simulate in each direction is given by the
timedataargument.- plot_streamlinesbool or dict, optional
If True then plot streamlines based on the pointdata and gridtype. If set to a dict, pass on the key-value pairs in the dict as keywords to
streamlines.- plot_vectorfieldbool or dict, optional
If True then plot the vector field based on the pointdata and gridtype. If set to a dict, pass on the key-value pairs in the dict as keywords to
phaseplot.vectorfield.- plot_streamplotbool or dict, optional
If True then use
matplotlib.axes.Axes.streamplotfunction to plot the streamlines. If set to a dict, pass on the key-value pairs in the dict as keywords tophaseplot.streamplot.- plot_equilpointsbool or dict, optional
If True (default) then plot equilibrium points based in the phase plot boundary. If set to a dict, pass on the key-value pairs in the dict as keywords to
phaseplot.equilpoints.- plot_separatricesbool or dict, optional
If True (default) then plot separatrices starting from each equilibrium point. If set to a dict, pass on the key-value pairs in the dict as keywords to
phaseplot.separatrices.- rcParamsdict
Override the default parameters used for generating plots. Default is set by
config.defaults['ctrlplot.rcParams'].- suppress_warningsbool, optional
If set to True, suppress warning messages in generating trajectories.
- titlestr, optional
Set the title of the plot. Defaults to plot type and system name(s).
Notes
The default method for producing streamlines is determined based on which keywords are specified, with
plot_streamplotserving as the generic default. If any of thearrows,arrow_size,arrow_style, ordirkeywords are used and neitherplot_streamlinesnorplot_streamplotis set, thenplot_streamlineswill be set to True. If neitherplot_streamlinesnorplot_vectorfieldset set to True, thenplot_streamplotwill be set to True.