recalculate loci for sisotool and rlocus on axis scaling by repagh · Pull Request #1153 · python-control/python-control

Pull Request Overview

This PR enables dynamic recalculation of root locus and pole-zero plots when the user pans or zooms in sisotool and rlocus, fixing issue #1151.

  • Integrate add_loci_recalculate callback into sisotool and root_locus_plot for auto-replot on axis changes
  • Extend root_locus_map signature to accept xlim, ylim and pass them through to gain calculation
  • Add replot support for pole-zero maps via a new pole_zero_replot function

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
control/sisotool.py Imported and invoked add_loci_recalculate, updated axis reference for root locus
control/rlocus.py Added xlim/ylim parameters, defined add_loci_recalculate, wired callback in root_locus_plot
control/pzmap.py Added replot method and pole_zero_replot for pole-zero redraw on zoom/pan
Comments suppressed due to low confidence (2)

control/sisotool.py:141

  • Variable axes is undefined here; you likely meant to use fig.axes or the local axes variable instead of axes.
ax_rlocus = axes[0,1] #fig.axes[1]

control/pzmap.py:552

  • ControlPlot instances expose their axes as cp.axes, not cp.ax. Update to cp.axes[0,0] to avoid AttributeError.
cp.lines[idx,2].append(cp.ax[0,0].plot(