-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: symlog scale generates false warning when mouse is moved #26118
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
Comments
I do not think this warning is erroneous and I see it as soon as the window shows (not on mouse motion). It is warning you that given the current data limits symlog is not doing anything for you (because you are fully in the linear range). If you do: import matplotlib.pyplot as plt
ax = plt.figure().add_subplot()
ax.set_yscale('symlog')
ax.set_ylim(0, 1000)
plt.show() you will not see the warning. |
I was fooled by the default limits triggering the warning. I can reproduce this on mouse motion. |
matplotlib/lib/matplotlib/scale.py Line 396 in 475612e
or short circuit and return earlier, before even calling |
Good first issue - notes for new contributorsThis issue is suited to new contributors because it does not require understanding of the Matplotlib internals. To get started, please see our contributing guide. We do not assign issues. Check the Development section in the sidebar for linked pull requests (PRs). If there are none, feel free to start working on it. If there is an open PR, please collaborate on the work by reviewing it rather than duplicating it in a competing PR. If something is unclear, please reach out on any of our communication channels. |
... yep - the question is, "who" sends these false empty values as the warning is also raised if valid data is plotted... |
I'm not a fan of having a warning here at all. People who don't understand symlog sometimes get confused, but I don't think that means we should spam potentially valid usage. |
Looks like it is actually in This is the method which gives the text which displays in the toolbar. It probably gets a single value, or a small number of values for neighboring pixels to determine what level of precision to display... at which point yeah... I think I agree with @jklymak that we should not be warning here... perhaps keep a warning on setting limits (potentially even auto limits, but I'm tempted to say only when explicitly setting limits), rather than just when transforming, which is not the right place for a warning... I'll remove the |
Actually, it is in the inverted symlog transform (and only the inverted transform)..., it was originally implemented for mpl 3.7.0 in #24555, but the idea stems from the issue #24550. I don't know that there is a much better hook if we do want a warning somewhere, but it does feel odd/limiting to warn whenever points in only the linear region are passed through the inverse transform... It is equally useless to use Perhaps @timhoffm can weigh in here, as author of the issue requesting this warning. |
... from my point of view, the warning itself is not the "problem". Here is a valid example throwing the same warning, when mouse is moved:
I think, there are 2 issues. The bug in
... and the bug in the mouse coordinate driver, which sends obviously (see above @ksunden ) None or length==0 values. Regarding the warning itself: If I have one diagram which I use for different datasets - and all points of one dataset are within the linear threshold, then this is a valid case - no reason to warn. Or in common: The warning is wrong ;-) and should be removed again. For completeness: As a workaround the warning can be suppressed for example with
|
FWIW I would agree with removing the warning. |
In further inspection, it looks like this is warning on the inverse (not the forward) transform that happens to also be called in the case that is tested (as part of sorting out how much the margin should be). Even if we move this to the correct transform, there are still too many places where we want to pass data just in range (e.g. we call the forward transform on mouse motion to estimate the pixel-to-pixel data range and ensure that the values printed in the toolbar are reasonably precise) |
…mlog-warn" This reverts commit 041d4e0, reversing changes made to fbfa28d. Closes matplotlib#26118
…mlog-warn" This reverts commit 041d4e0, reversing changes made to fbfa28d. Closes matplotlib#26118
Bug summary
When using symlog scale for an axis, a false warning is initially generated - independant of the data to plot - as soon as the mouse is moved over the axes.
Code for reproduction
Actual outcome
UserWarning: All values for SymLogScale are below linthresh, making it effectively linear. You likely should lower the value of linthresh.
Expected outcome
"Nothing"
Additional information
... maybe related to TkAgg?
Operating system
Windows
Matplotlib Version
3.7.0
Matplotlib Backend
TkAgg
Python version
3.11.2
Jupyter version
No response
Installation
pip
The text was updated successfully, but these errors were encountered: