-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
math domain error using symlog norm #7595
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
Thanks for the clear example. It looks like this is part of what I am trying to sort our right now, so this additional case is very helpful. |
If you omit the 'format' kwarg, the colorbar tick formatting works as expected. |
Hmm, I don't actually know why that was ever necessary. Looks like it was added to yt in 2014 when we added support for symlog scaling: https://bitbucket.org/yt_analysis/yt/commits/06c5cb9b11174a8d24c6e9f30181c0f03a0da3d9 I think the ticks are still correct under both 1.5.3 and 2.0.0rc1 when I remove the |
I added explicit SymlogNorm support, causing use of the LogFormatterSciNotation, in 2.0. In 1.5.3 it doesn't treat the SymlogNorm specially, so the labels are formatted as ordinary scalars and the ticks are linearly placed. So the format kwarg as you have it helps with 1.5.3. The problem is that with changes in 2.0, the formatter needs an additional kwarg, 'linthresh' (which did not exist in 1.5.3). I think I see how to make it work without that kwarg in a case like this, but without the improvements you get with 2.0 when you don't use the kwarg. |
Closes matplotlib#7595, matplotlib#7493, matplotlib#7587. Bbox._minpos is now initialized to [np.inf, np.inf] instead of [1e-7, 1e-7]. Old code with a colorbar in which the formatter is set to a LogFormatter and a SymlogNorm is used now works again (although the results are better in 2.0 if the colorbar is left to handle the formatter automatically). LogLocator now has its own nonsingular() method which provides a reasonable starting point for a log axis when no data have been plotted.
Closes matplotlib#7595, matplotlib#7493, matplotlib#7587. Bbox._minpos is now initialized to [np.inf, np.inf] instead of [1e-7, 1e-7]. Old code with a colorbar in which the formatter is set to a LogFormatter and a SymlogNorm is used now works again (although the results are better in 2.0 if the colorbar is left to handle the formatter automatically). LogLocator now has its own nonsingular() method which provides a reasonable starting point for a log axis when no data have been plotted.
I stumbled across this regression trying to use the matplotlib 2.0 release candidate with yt.
In yt we have a plotting class called SlicePlot that will switch to a symlog colorbar if a user tries to plot a field that we want to be log-scaled because it has a lot of dynamic range but that also has negative values. A very simple yt script (that works fine under matplotlib 1.5.3 but dies with a traceback under 2.0.0rc1) that triggers this looks like:
To make this easier for people who aren't familiar with yt internals to digest, I've come up with the following test script that only uses matplotlib but triggers what I think is the same error:
It produces the following traceback:
Under matplotlib 1.5.3 the same script produces the following image:
The text was updated successfully, but these errors were encountered: