You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SymmetricalLogLocator adds extra erroneous major ticks due to floating-point precision error #18757
SymmetricalLogLocator appears to suffer a floating-point precision error in calculating the boundaries of the log regions of a symlog plot, which results in the addition of extra major ticks in the linear region of the plot.
Major ticks generated by SymmetricalLogLocator sometimes include an extra tick in the linear region:
>>>locator=mpl.ticker.SymmetricalLogLocator(linthresh=1e3, base=10)
>>>locator.tick_values(vmin=0, vmax=1e6)
# array([0.e+00, 1.e+02, 1.e+03, 1.e+04, 1.e+05, 1.e+06]) <-- 1.e+02 is in the linear region
With the np.floor() calculation, this introduces an additional erroneous innermost major tick.
@dstansby proposed a possible fix to a related issue in #14309, which changes np.floor() to np.ceil(). This looks like it would work with the precision errors I identified above, which all err towards zero, but it would fail with bases that err away from zero, e.g., base=5:
Other possible solutions I can think of: (1) rounding to base within a certain proximity, or (2) adding a special case when base=10 wherein np.log10() is used instead of np.log()/np.log(base).
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
Activity
github-actions commentedon Aug 30, 2023
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!