Skip to content
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

control.bode configured with omega_limits not showing minor ticks #938

Open
lpdx opened this issue Oct 26, 2023 · 1 comment
Open

control.bode configured with omega_limits not showing minor ticks #938

lpdx opened this issue Oct 26, 2023 · 1 comment

Comments

@lpdx
Copy link

lpdx commented Oct 26, 2023

Using omega_limits with 8 dacades we can make Bode plots successfully with both major and minor ticks.
But when increasing then omega_limits to 9 decades the minor ticks in xaxis are not plotted.

Library Version
control 0.9.4
matplotlib 3.7.2

Minimum working example:

import control
import matplotlib.pyplot as plt

omega_limits = [0.1,1000000]

G = control.tf(1,[1,5000])

plt.figure(figsize=[10,5])
control.bode(G,omega_limits=omega_limits, Hz=True)
plt.savefig('correct.png')
plt.show()

correct

When increasing the omega upper limit to 10000000 (one decade above) the ticks are missing:

import control
import matplotlib.pyplot as plt

omega_limits = [0.1,10000000]

G = control.tf(1,[1,5000])

plt.figure(figsize=[10,5])
control.bode(G,omega_limits=omega_limits, Hz=True)
plt.savefig('wrong.png')
plt.show()

wrong

Is this a bug or an undocumented limitation of the package?

I tried to force show minor ticks but it does not work.

@sawyerbfuller
Copy link
Contributor

Might be automatic behavior in Matplotlib? Makes sense to me that at some level of zoom, the small minor lines would become too much. I looked in the source code and didn't find anything indicating that python-control was playing with these minor grid lines: https://github.com/python-control/python-control/blob/main/control/freqplot.py

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

No branches or pull requests

2 participants