Skip to content

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

Description

@lpdx

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.

Activity

  1. sawyerbfuller commented on Oct 26, 2023

    @sawyerbfuller
    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

  2. self-assigned this
    on Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions