From d13f1ed4d1bd68905fb6fb109822b23d24b67102 Mon Sep 17 00:00:00 2001 From: Henk van der Laak Date: Wed, 22 Feb 2023 03:43:57 +0100 Subject: [PATCH] Fix root_locus() handling of ax parameter --- control/rlocus.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/control/rlocus.py b/control/rlocus.py index 53c5c9031..60565d48d 100644 --- a/control/rlocus.py +++ b/control/rlocus.py @@ -260,7 +260,7 @@ def root_locus(sys, kvect=None, xlim=None, ylim=None, if isdtime(sys, strict=True): zgrid(ax=ax) else: - _sgrid_func(fig=fig if sisotool else None) + _sgrid_func(ax) else: ax.axhline(0., linestyle=':', color='k', linewidth=.75, zorder=-20) ax.axvline(0., linestyle=':', color='k', linewidth=.75, zorder=-20) @@ -660,13 +660,7 @@ def _removeLine(label, ax): del line -def _sgrid_func(fig=None, zeta=None, wn=None): - if fig is None: - fig = plt.gcf() - ax = fig.gca() - else: - ax = fig.axes[1] - +def _sgrid_func(ax, zeta=None, wn=None): # Get locator function for x-axis, y-axis tick marks xlocator = ax.get_xaxis().get_major_locator() ylocator = ax.get_yaxis().get_major_locator()