Repository: python-control/python-control

Issue:
Matplotlib join() deprecated; need to update sisotool
In doing the release for v0.9.3, I found the following warning in the logs:
```
/home/runner/work/python-control/python-control/control/sisotool.py:161: MatplotlibDeprecationWarning: The join function was deprecated in Matplotlib 3.6 and will be removed two minor releases later.
[3339](https://github.com/python-control/python-control/actions/runs/3808966270/jobs/6480141305#step:6:3340)
    ax_phase.get_shared_x_axes().join(ax_phase, ax_mag)
```
We should fix this at some point.

Discussion:

Patch:
diff --git a/control/sisotool.py b/control/sisotool.py
index 2b735c0a..8a3b3d9f 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)


Test patch:
diff --git a/control/tests/sisotool_test.py b/control/tests/sisotool_test.py
index d4a29105..fde5eba2 100644
--- a/control/tests/sisotool_test.py
+++ b/control/tests/sisotool_test.py
@@ -83,6 +83,12 @@ class TestSisotool:
             '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 @@ class TestSisotool:
         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],