@@ -423,6 +423,114 @@ Instead, the plot is generated directly be a call to the
423423:mod: `~control.phaseplot ` helper functions.
424424
425425
426+ Customizing control plots
427+ =========================
428+
429+ A set of common options are available to customize control plots in
430+ various ways. The following general rules apply:
431+
432+ * If a plotting function is called multiple times with data that generate
433+ control plots with the same shape for the array of subplots, the new data
434+ will be overlayed with the old data, with a change in color(s) for the
435+ new data (chosen from the standard matplotlib color cycle). If not
436+ overridden, the plot title and legends will be updated to reflect all
437+ data shown on the plot.
438+
439+ * If a plotting function is called and the shape for the array of subplots
440+ does not match the currently displayed plot, a new figure is created.
441+ Note that only the shape is checked, so if two different types of
442+ plotting commands that generate the same shape of suplots are called
443+ sequentially, the :func: `matplotlib.pyplot.figure ` command should be used
444+ to explicitly create a new figure.
445+
446+ * The ``ax `` keyword argument can be used to direct the plotting function
447+ to use a specific axes or array of axes. The value of the ``ax `` keyword
448+ must have the proper number of axes for the plot (so a plot generating a
449+ 2x2 array of subplots should be given a 2x2 array of axes for the ``ax ``
450+ keyword).
451+
452+ * The ``label `` keyword argument can be used to override the line labels
453+ that are used in generating the title and legend. If more than one line
454+ is being plotted in a given call to a plot command, the ``label ``
455+ argument value should be a list of labels, one for each line, in the
456+ order they will appear in the legend.
457+
458+ For input/output plots (frequency and time responses), the labels that
459+ appear in the legend are of the form "<output name>, <input name>, <trace
460+ name>, <system name>". The trace name is used only for multi-trace time
461+ plots (for example, step responses for MIMO systems). Common information
462+ present in all traces is removed, so that the labels appearing in the
463+ legend represent the unique characteristics of each line.
464+
465+ For non-input/output plots (e.g., Nyquist plots, pole/zero plots, root
466+ locus plots), the default labels are the system name.
467+
468+ If ``label `` is set to ``False ``, individual lines are still given
469+ labels, but no legend is generated in the plot (this can also be
470+ accomplished by setting ``legend_map `` to ``False ``.
471+
472+ Note: the ``label `` keyword argument is not implemented for describing
473+ function plots or phase plane plots, since these plots are primarily
474+ intended to be for a single system. Standard ``matplotlib `` commands can
475+ be used to customize these plots for displaying information for multiple
476+ systems.
477+
478+ * The ``legend_loc ``, ``legend_map `` and ``show_legend `` keyword arguments
479+ can be used to customize the locations for legends. By default, a
480+ minimal number of legends are used such that lines can be uniquely
481+ identified and no legend is generated if there is only one line in the
482+ plot. Setting ``show_legend `` to ``False `` will suppress the legend and
483+ setting it to ``True `` will force the legend to be displayed even if
484+ there is only a single line in each axes. In addition, if the value of
485+ the ``legend_loc `` keyword argument is set to a string or integer, it
486+ will set the position of the legend as described in the
487+ :func: `matplotlib.legend` ` documentation. Finally, ``legend_map `` can be
488+ set to an` array that matches the shape of the suplots, with each item
489+ being a string indicating the location of the legend for that axes (or
490+ ``None `` for no legend).
491+
492+ * The ``rcParams `` keyword argument can be used to override the default
493+ matplotlib style parameters used when creating a plot. The default
494+ parameters for all control plots are given by the ``ct.rcParams ``
495+ dictionary and have the following values:
496+
497+ .. list-table ::
498+ :widths: 50 50
499+ :header-rows: 1
500+
501+ * - Key
502+ - Value
503+ * - 'axes.labelsize'
504+ - 'small'
505+ * - 'axes.titlesize'
506+ - 'small'
507+ * - 'figure.titlesize'
508+ - 'medium'
509+ * - 'legend.fontsize'
510+ - 'x-small'
511+ * - 'xtick.labelsize'
512+ - 'small'
513+ * - 'ytick.labelsize'
514+ - 'small'
515+
516+ Only those values that should be changed from the default need to be
517+ specified in the ``rcParams `` keyword argument. To override the defaults
518+ for all control plots, update the ``ct.rcParams `` dictionary entries.
519+
520+ The default values for style parameters for control plots can be restored
521+ using :func: `~control.reset_rcParams `.
522+
523+ * The ``title `` keyword can be used to override the automatic creation of
524+ the plot title. The default title is a string of the form "<Type> plot
525+ for <syslist>" where <syslist> is a list of the sys names contained in
526+ the plot (which can be updated if the plotting is called multiple times).
527+ Use ``title=False `` to suppress the title completely. The title can also
528+ be updated using the :func: `~control.ControlPlot.set_plot_title ` method
529+ for the returned control plot object.
530+
531+ The plot title is only generated if ``ax `` is ``None ``.
532+
533+
426534Response and plotting functions
427535===============================
428536
@@ -432,7 +540,7 @@ Response functions
432540Response functions take a system or list of systems and return a response
433541object that can be used to retrieve information about the system (e.g., the
434542number of encirclements for a Nyquist plot) as well as plotting (via the
435- `plot ` method).
543+ `` plot ` ` method).
436544
437545.. autosummary ::
438546 :toctree: generated/
@@ -481,8 +589,8 @@ returned values from plotting routines.
481589 :toctree: generated/
482590
483591 ~control.combine_time_responses
484- ~control.get_plot_axes
485- ~ control.suptitle
592+ ~control.reset_rcParams
593+ control.ControlPlot.set_plot_title
486594
487595
488596Response and plotting classes
0 commit comments