Open
Description
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
matplotlib/lib/matplotlib/scale.py
Line 392 in 4e059bc
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.