Skip to content
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

Make tick finding more compatible with Float64 #161

Merged
merged 5 commits into from
Mar 5, 2024

Conversation

ffreyer
Copy link
Contributor

@ffreyer ffreyer commented Mar 4, 2024

While working on MakieOrg/Makie.jl#3663 I noticed that ticks are broken for 1e9 .+ (1:10):

Screenshot from 2024-03-04 15-25-37

In this case PlotUtils switches to fallback_ticks as 9 / 1e9 < sqrt(eps(Float64)) ~ 1e-8 and we get (min, 0.5 * (max + min), max). Our pretty-string functions then round those values to integers, I assume.

To avoid the PlotUtils part of the problem I think just adjusting the rtol is enough. With rtol = 1000.0 * eps(T) the tolerance should be about the same for Float32 and 1e-13 for Float64. With that the plot becomes:

Screenshot from 2024-03-04 17-37-37

@asinghvi17
Copy link
Member

From the test logs it looks like this fails when the input is an Int64, since there's no definition of eps for that.

@t-bltg
Copy link
Member

t-bltg commented Mar 4, 2024

Could you also add some tests to runtests.jl ?

@codecov-commenter
Copy link

codecov-commenter commented Mar 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.83%. Comparing base (f16e07a) to head (e9a0491).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #161      +/-   ##
==========================================
- Coverage   72.05%   71.83%   -0.22%     
==========================================
  Files           7        7              
  Lines         662      664       +2     
==========================================
  Hits          477      477              
- Misses        185      187       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@asinghvi17 asinghvi17 requested a review from t-bltg March 5, 2024 04:03
Copy link
Member

@asinghvi17 asinghvi17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks @ffreyer!

@t-bltg t-bltg merged commit c03d790 into JuliaPlots:master Mar 5, 2024
12 checks passed
@ffreyer ffreyer deleted the ff/Float64_compat branch March 5, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants