8000 [ENH]: Warn when a SymLogScale receives values that are all in the linear regime · Issue #24550 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[ENH]: Warn when a SymLogScale receives values that are all in the linear regime #24550
Open
@timhoffm

Description

@timhoffm

Problem

Inspired by #24549. When all values are below linthresh, the SymLogScale looks like a linear scale. This is most certainly not intended by the user.

Proposed solution

Add a warning. This is possibly as simple as adding

if (abs_a < linthresh).all():
    _api.warn_external(
        "All values for SymLogScale are below linthresh, making it effectively "
        "linear. You likely should lower the value of linthresh.")

at

with np.errstate(divide="ignore", invalid="ignore"):

Marking as good first issue. A pull request should contain a test that the warning is actually triggered.

Optional further improvements:

  • Suggest a reasonable value
  • Warn also when there are parts in the log scale, but the screen space would still be dominated by the linear scale. This is not fundamentally difficult, but needs a bit of fiddling with numbers (also including linscale).
  • Investigate whether we can automatically determine linthresh. This may or may not be feasible, because it affects the figure and the place where we have knowledge to do so may not necessarily be the place where such a visual-affecting change could be made.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Hardhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesNew feature

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0