From 6c90c206e4eb5a88cb1c3cb6c6b90eb0779e4d2a Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Sat, 31 Dec 2022 21:26:35 +0100 Subject: [PATCH 1/2] Sisotool test: must be shared --- control/tests/sisotool_test.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/control/tests/sisotool_test.py b/control/tests/sisotool_test.py index d4a291052..fde5eba2b 100644 --- a/control/tests/sisotool_test.py +++ b/control/tests/sisotool_test.py @@ -83,6 +83,12 @@ def test_sisotool(self, tsys): 'margins': True } + # Check that the xaxes of the bode plot are shared before the rlocus click + assert ax_mag.get_xlim() == ax_phase.get_xlim() + ax_mag.set_xlim(2, 12) + assert ax_mag.get_xlim() == (2, 12) + assert ax_phase.get_xlim() == (2, 12) + # Move the rootlocus to another point event = type('test', (object,), {'xdata': 2.31206868287, 'ydata': 15.5983051046, @@ -116,6 +122,12 @@ def test_sisotool(self, tsys): assert_array_almost_equal( ax_step.lines[0].get_data()[1][:10], step_response_moved, 4) + # Check that the xaxes of the bode plot are still shared after the rlocus click + assert ax_mag.get_xlim() == ax_phase.get_xlim() + ax_mag.set_xlim(3, 13) + assert ax_mag.get_xlim() == (3, 13) + assert ax_phase.get_xlim() == (3, 13) + @pytest.mark.skipif(plt.get_current_fig_manager().toolbar is None, reason="Requires the zoom toolbar") @pytest.mark.parametrize('tsys', [0, True], From b7baec0363f6d01e4201068a4364c8b951f2ce0e Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Sat, 31 Dec 2022 21:35:02 +0100 Subject: [PATCH 2/2] GrouperView.join() is deprecated, call highlevel sharex if needed --- control/sisotool.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/control/sisotool.py b/control/sisotool.py index 2b735c0af..8a3b3d9f7 100644 --- a/control/sisotool.py +++ b/control/sisotool.py @@ -158,9 +158,11 @@ def _SisotoolUpdate(sys, fig, K, bode_plot_params, tvect=None): ax_phase.set_xlabel(ax_phase.get_xlabel(),fontsize=label_font_size) ax_phase.set_ylabel(ax_phase.get_ylabel(),fontsize=label_font_size) ax_phase.get_xaxis().set_label_coords(0.5, -0.15) - ax_phase.get_shared_x_axes().join(ax_phase, ax_mag) ax_phase.tick_params(axis='both', which='major', labelsize=label_font_size) + if not ax_phase.get_shared_x_axes().joined(ax_phase, ax_mag): + ax_phase.sharex(ax_mag) + ax_step.set_title('Step response',fontsize = title_font_size) ax_step.set_xlabel('Time (seconds)',fontsize=label_font_size) ax_step.set_ylabel('Output',fontsize=label_font_size)