Skip to content

pzmap() function not work, zero not plotted #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
elviseno opened this issue Aug 8, 2017 · 9 comments
Closed

pzmap() function not work, zero not plotted #154

elviseno opened this issue Aug 8, 2017 · 9 comments
Assignees
Labels
Milestone

Comments

@elviseno
Copy link

elviseno commented Aug 8, 2017

For the same control.TransferFunction() sys, if I called with python version control.pzmap(), it reports that

TypeError: 'module' object is not callable

If called control.matlab.pzmap() it does plot the poles but not zeros. I checked the code that when plotting zeros, facecolors is set to 'none'.

How can I change the color back? I think it's more reasonable to set a proper color for this line.

Thanks.

@murrayrm
Copy link
Member

murrayrm commented Aug 8, 2017

Can you provide a code snippet that generates both errors? Thanks.

@elviseno
Copy link
Author

elviseno commented Aug 9, 2017

Hi Murray,
The control package is 0.7.0.
A simple test code used,

tf = control.TransferFunction([1,1],[1,1,1])
control.pzmap(tf)

It reports,

TypeError Traceback (most recent call last)
in ()
1 tf = control.TransferFunction([1,1],[1,1,1])
----> 2 control.pzmap(tf)
3 # control.matlab.pzmap(tf)
4 # pole, zero = control.matlab.pzmap(tf_mindist)
5 plt.show()
TypeError: 'module' object is not callable

control.matlab.pzmap(tf) is working fine except that zeros are not shown.
In pzmap file,

if len(zeros) > 0:
            plt.scatter(real(zeros), imag(zeros), s=50, marker='o', facecolors='none')

The zeros are shown after removing facecolors setting.

It seems the 2 pzmap functions are essentially the same one. Sorry I'm not coder and can't digg too much.

Thanks very much.

@slivingston
Copy link
Member

so, completing the example from above to include necessary imports and the show command, we have

import matplotlib.pyplot as plt
import control

tf = control.TransferFunction([1,1],[1,1,1])
control.pzmap(tf)
plt.show()

@slivingston
Copy link
Member

I am able to reproduce the reported behavior of missing zero markers. My hypothesis is some previous version of Matplotlib included marker edges by default, so facecolors='none' was sufficient to cause circle outlines. One way to achieve it now is

if len(zeros) > 0:
    plt.scatter(real(zeros), imag(zeros), s=50, marker='o',
                facecolors='none', edgecolors='g')

@slivingston slivingston self-assigned this Aug 9, 2017
@slivingston
Copy link
Member

regarding the TypeError exception, I was not able to produce the error using the tip of master branch, whereas I can reproduce the error using the previous release version 0.7.0.

@slivingston
Copy link
Member

@Fankbai context?

@Fankbai
Copy link

Fankbai commented Aug 26, 2017

@slivingston

def polezero(): 
        h= control.tf([2.27612463, -3.07696238,  2.10964293, -0.83921913],[1])
        b = pzmap(h)	
	plt.show()
polezero()

@murrayrm murrayrm added the bug label Dec 30, 2017
@Sup3rGeo
Copy link

PR #193 addresses it

@murrayrm murrayrm added this to the 0.8.2 milestone Jul 18, 2018
@murrayrm
Copy link
Member

Fixed in PR #193.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants