You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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()
So I think I figured it out, in grid.py in _final_setupplt.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 could document this in our documentation.
I could come up with logic similar to plt.axis('equal') which finds the max values of date and sets the limits to an equal limit to start but then allows for users to change the limits as they see fit.
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.
Activity
murrayrm commentedon Oct 5, 2019
I confirmed this behavior in the latest version of master, but not clear whether this is an issue with
python-controlor withmatplotlib. If someone has time, perhaps see if you can show that it works correctly if you create that plot outside ofpython-controland then we can chase down what is going wrong (and in which package)?BTW, I tried calling
plt.xlim()afterplot.show()to see what happened and I got very strange results.zachsez commentedon May 17, 2020
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 controlis the source/master fork I have instead of the released module I previously installed with pip.murrayrm commentedon May 17, 2020
The master branch should say something like
0.8.3.post16.zachsez commentedon May 17, 2020
I got 0.8.1, just doubled checked and master is checkout at commit
03183d1murrayrm commentedon May 17, 2020
That's the latest commit for master, so it sounds like you are not picking up the latest version. Try
pip uninstall controlto get rid of the old version then runpython setup.py installin the python-control source directory to install the latest version of master.zachsez commentedon May 17, 2020
Ok I think its working now its says
devwhen 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!
zachsez commentedon May 19, 2020
So I think I figured it out, in
grid.pyin_final_setupplt.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:
murrayrm commentedon May 20, 2020
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
matplotlibto "relax" the rules forplt.axis("equal")that would allow rescaling of one of the axes.