Skip to content

I'm having problems with the ax parameters of the rlocus function #623

@jolenscki

Description

@jolenscki

I was trying today to plot the root locus of a transfer function, but wanted to pass a specific axes object to it, so I tried to use the ax parameter of the rlocus function:

from control import *
import matplotlib.pyplot as plt

s = tf([1, 0], 1)
G = 1/(s*(s+1))

fig, ax = plt.subplots(dpi=200)
rlocus(G, ax=ax)

But when doing this, the following error was raised:

---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-1-80498c4b1a54> in <module>
      6 
      7 fig, ax = plt.subplots(dpi=200)
----> 8 rlocus(G, ax=ax)

~\anaconda3\lib\site-packages\control\rlocus.py in root_locus(sys, kvect, xlim, ylim, plotstr, plot, print_gain, grid, ax, **kwargs)
    173 
    174         if print_gain and not sisotool:
--> 175             fig.canvas.mpl_connect(
    176                 'button_release_event',
    177                 partial(_RLClickDispatcher, sys=sys, fig=fig,

UnboundLocalError: local variable 'fig' referenced before assignment

Control version: 0.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy