Title: Control plot refactoring for consistent functionality by murrayrm · Pull Request #1034 · python-control/python-control · GitHub
Open Graph Title: Control plot refactoring for consistent functionality by murrayrm · Pull Request #1034 · python-control/python-control
X Title: Control plot refactoring for consistent functionality by murrayrm · Pull Request #1034 · python-control/python-control
Description: This PR makes a (fairly large) number of changes to control plotting functions to provide consistent functionality. The majority of changes involve making functionality that was present in some plot functions but not others available consistently across all _plot() functions. Everything is backward compatible with v0.10.0. Summary of changes: Change output format for plotting commands to a ControlPlot object, with lines, axes, legend, etc available. Accessing this object as a list is backward compatible with 10.0 format (with deparecation warning). Make processing of the ax keyword consistent across all plotting functions (using ctrlplot._process_ax_keyword). Fix up the label keyword to operate in a consistent and more intuitive manner: labels can be specified as a single string, a simple list, or an array (for MIMO and multi-trace systems). If a single list is given for a MIMO or multi-trace system, it is reshaped as needed. Change ct.suptitle() to cplt.set_plot_title() (where cplt is the returned ControlPlot obect from a plotting command), and update the plot() method to provide uniform processing of the title keyword (when present, overrides title). Deprecated the relabel keyword in time_response_plot. This didn't seem to be that useful and was not implemented for other functions. Updated legend processing to be consistent across all plotting functions, as described in the user documention (below). Includes unit tests + docstring updates. Updated the use of rcParams for control plotting functions: defaults are now in ct.rcParams and can be reset using ct.reset_rcParams. Set up uniform processing of the rcParams keyword argument for plotting functions (with unit tests). Unified color and *fmt argument processing code, in addition to color management for sequential plotting (_get_color_offset, _get_color). Put together a sample code skeleton for creating a control plots (at the top of ctrlplot.py. Unit tests to make sure all plotting commands perform consistently, including documentation checks. Documentation of new functionality (from plotting.rst): Customizing control plots A set of common options are available to customize control plots in various ways. The following general rules apply: If a plotting function is called multiple times with data that generate control plots with the same shape for the array of subplots, the new data will be overlaid with the old data, with a change in color(s) for the new data (chosen from the standard matplotlib color cycle). If not overridden, the plot title and legends will be updated to reflect all data shown on the plot. If a plotting function is called and the shape for the array of subplots does not match the currently displayed plot, a new figure is created. Note that only the shape is checked, so if two different types of plotting commands that generate the same shape of subplots are called sequentially, the matplotlib.pyplot.figure command should be used to explicitly create a new figure. The ax keyword argument can be used to direct the plotting function to use a specific axes or array of axes. The value of the ax keyword must have the proper number of axes for the plot (so a plot generating a 2x2 array of subplots should be given a 2x2 array of axes for the ax keyword). The color, linestyle, linewidth, and other matplotlib line property arguments can be used to override the default line properties. If these arguments are absent, the default matplotlib line properties are used and the color cycles through the default matplotlib color cycle. The :func:~control.bode_plot, :func:~control.time_response_plot, and selected other commands can also accept a matplotlib format string (e.g., 'r--'). The format string must appear as a positional argument right after the required data argument. Note that line property arguments are the same for all lines generated as part of a single plotting command call, including when multiple responses are passed as a list to the plotting command. For this reason it is often easiest to call multiple plot commands in sequence, with each command setting the line properties for that system/trace. The label keyword argument can be used to override the line labels that are used in generating the title and legend. If more than one line is being plotted in a given call to a plot command, the label argument value should be a list of labels, one for each line, in the order they will appear in the legend. For input/output plots (frequency and time responses), the labels that appear in the legend are of the form "
Open Graph Description: This PR makes a (fairly large) number of changes to control plotting functions to provide consistent functionality. The majority of changes involve making functionality that was present in some pl...
X Description: This PR makes a (fairly large) number of changes to control plotting functions to provide consistent functionality. The majority of changes involve making functionality that was present in some pl...
Opengraph URL: https://github.com/python-control/python-control/pull/1034
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:407f9b72-7923-0790-fe42-9c83577e1921 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | E646:17B78D:1E4044A:2AA5368:697A5536 |
| html-safe-nonce | abf87410159c9247fb4838cd1327319f257ba17e898eda27b2a1c06095fc5b4b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjQ2OjE3Qjc4RDoxRTQwNDRBOjJBQTUzNjg6Njk3QTU1MzYiLCJ2aXNpdG9yX2lkIjoiMzMxNTQwNDU5MzIxODM0NDI0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cd22f6a766275ea2b7b5f13c0f586ba42c7c1582f93becb3447b308f7de6a6e0 |
| hovercard-subject-tag | pull_request:1980043397 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python-control/python-control/pull/1034/checks |
| twitter:image | https://avatars.githubusercontent.com/u/293362?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/293362?s=400&v=4 |
| og:image:alt | This PR makes a (fairly large) number of changes to control plotting functions to provide consistent functionality. The majority of changes involve making functionality that was present in some pl... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a2296221ffa83b7f45f8ba9b62e1aed869492cb43693309e51b8111607e38282 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-control/python-control git https://github.com/python-control/python-control.git |
| octolytics-dimension-user_id | 2285872 |
| octolytics-dimension-user_login | python-control |
| octolytics-dimension-repository_id | 22791752 |
| octolytics-dimension-repository_nwo | python-control/python-control |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 22791752 |
| octolytics-dimension-repository_network_root_nwo | python-control/python-control |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 46d8a07df71eb59259545c68ce36abf1075d2fca |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width