|
32 | 32 | {'color': c} for c in [ |
33 | 33 | 'tab:red', 'tab:purple', 'tab:brown', 'tab:olive', 'tab:cyan']], |
34 | 34 | 'timeplot.time_label': "Time [s]", |
| 35 | + 'timeplot.sharex': 'col', |
| 36 | + 'timeplot.sharey': False, |
35 | 37 | } |
36 | 38 |
|
37 | 39 |
|
@@ -66,6 +68,14 @@ def time_response_plot( |
66 | 68 | overlay_signals : bool, optional |
67 | 69 | If set to True, combine all input and output signals onto a single |
68 | 70 | plot (for each). |
| 71 | + sharex, sharey : str or bool, optional |
| 72 | + Determine whether and how x- and y-axis limits are shared between |
| 73 | + subplots. Can be set set to 'row' to share across all subplots in |
| 74 | + a row, 'col' to set across all subplots in a column, 'all' to share |
| 75 | + across all subplots, or `False` to allow independent limits. |
| 76 | + Default values are `False` for `sharex' and 'col' for `sharey`, and |
| 77 | + can be set using config.defaults['timeplot.sharex'] and |
| 78 | + config.defaults['timeplot.sharey']. |
69 | 79 | transpose : bool, optional |
70 | 80 | If transpose is False (default), signals are plotted from top to |
71 | 81 | bottom, starting with outputs (if plotted) and then inputs. |
@@ -176,6 +186,8 @@ def time_response_plot( |
176 | 186 | # |
177 | 187 | # Set up defaults |
178 | 188 | ax_user = ax |
| 189 | + sharex = config._get_param('timeplot', 'sharex', kwargs, pop=True) |
| 190 | + sharey = config._get_param('timeplot', 'sharey', kwargs, pop=True) |
179 | 191 | time_label = config._get_param( |
180 | 192 | 'timeplot', 'time_label', kwargs, _timeplot_defaults, pop=True) |
181 | 193 | rcParams = config._get_param('ctrlplot', 'rcParams', kwargs, pop=True) |
@@ -289,7 +301,8 @@ def time_response_plot( |
289 | 301 | nrows, ncols = ncols, nrows |
290 | 302 |
|
291 | 303 | # See if we can use the current figure axes |
292 | | - fig, ax_array = _process_ax_keyword(ax, (nrows, ncols), rcParams=rcParams) |
| 304 | + fig, ax_array = _process_ax_keyword( |
| 305 | + ax, (nrows, ncols), rcParams=rcParams, sharex=sharex, sharey=sharey) |
293 | 306 | legend_loc, legend_map, show_legend = _process_legend_keywords( |
294 | 307 | kwargs, (nrows, ncols), 'center right') |
295 | 308 |
|
|
0 commit comments