Open limaries30 opened 5 years ago
I confirmed this behavior in the latest version of master, but not clear whether this is an issue with python-control
or with matplotlib
. If someone has time, perhaps see if you can show that it works correctly if you create that plot outside of python-control
and then we can chase down what is going wrong (and in which package)?
BTW, I tried calling plt.xlim()
after plot.show()
to see what happened and I got very strange results.
I don't have any issue, but then again I'm not sure I'm using all the right versions... How do I make sure the import control
is the source/master fork I have instead of the released module I previously installed with pip.
import control
print(control.__version__)
The master branch should say something like 0.8.3.post16
.
I got 0.8.1, just doubled checked and master is checkout at commit 03183d1
That's the latest commit for master, so it sounds like you are not picking up the latest version. Try pip uninstall control
to get rid of the old version then run python setup.py install
in the python-control source directory to install the latest version of master.
Ok I think its working now its says dev
when I print the version thank you for the help. I am able to create the problem described above but when I create my own plot for the poles and zeros its works fine...
plt.figure(2)
X = [x.real for x in poles]
Y = [x.imag for x in poles]
W = [x.real for x in zeros]
Z = [x.imag for x in zeros]
plt.scatter(X, Y, s=50, marker='x', facecolors='red')
plt.scatter(W, Z, s=50, marker='o', facecolors='blue')
plt.xlim((-0.2, 0.2))
plt.show()
I'll keep digging!
So I think I figured it out, in grid.py
in _final_setup
plt.axis('equal')
is called looking at the documentation here in order to maintain that equal aspect ratio the plot will may ignore xlim and ylim if it adjusts the figure out of an equal aspect ratio.
Idea's:
We should definitely do the first (at a minimum), but the second is the preferred option, I think. There may also be a way to tell matplotlib
to "relax" the rules for plt.axis("equal")
that would allow rescaling of one of the axes.
plt.xlim doesn;t work for me on tight range. For example plt.xlim((0,1)) works well, but when I run with plt.xlim((-0.1,0.1)) the range won't change.
Any solutions?