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

Fix occasional long ticks #1513

Merged
merged 1 commit into from Dec 14, 2021
Merged

Fix occasional long ticks #1513

merged 1 commit into from Dec 14, 2021

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Dec 14, 2021

I didn't look into the details, but I think optimize_ticks used to convert any input to Float64 when calculating ticks. This was changed in JuliaPlots/PlotUtils.jl#124 so a Float32 input now results in Float32 ticks. Occasionally ticks are off by a bit, e.g.

ticks = PlotUtils.optimize_ticks(0.25314125f0, 0.94421935f0, k_min = 4, k_max = 8)[1]
# Float32[0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.90000004]

This also happened before, but on the Float64 level.

Showoff.jl ignored the single bit differences in Float64, but not in Float32, so now we get long tick labels:

Showoff.showoff(Float32[0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.90000004], :plain)
# ["0.30000001", "0.40000001", "0.50000000", "0.60000002", "0.69999999", "0.80000001", "0.90000004"]

See JuliaGraphics/Showoff.jl#44

As a quick fix converting our ticks to Float64 before passing them should work.

Example from CI in #1512: (This is short_test_67.png)
short_tests_67

@SimonDanisch SimonDanisch merged commit 929fd19 into master Dec 14, 2021
@SimonDanisch SimonDanisch deleted the ff/fixes branch December 14, 2021 21:35
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.

None yet

2 participants