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
[BUG]: floating-point artefacts in tick labels #7765
Thanks for the report! The default tickformat works fine, but ~r and some of the other d3-format specs show this behavior.
In this case the behavior is clearly a bug, since you didn't specify tick0 so it defaults to 0 therefore it's unambiguous that the tick should be exactly at zero. And we could make a narrow fix that says "if the tick value is close to tick0 (much closer than whatever we've calculated as dtick), set it to exactly tick0. That would cover the 99% use case.
The one case it wouldn't cover is if someone sets a nonzero tick0 but there's still a tick that should fall exactly on zero. Like tick0=1 and dtick=0.1. If we wanted to ensure we're robust in that situation, but still allow things that are not quite that to honor the user's intent like tick0=1.0001 and dtick=0.1, we'd need some sort of heuristic for how close to zero, as a fraction of dtick, counts as zero. One millionth? One billionth?
Thanks for the report! This does indeed look like a bug. Our team likely won't have time to address this for a while, but can prioritize a PR review if you want to look into it.
Activity
alexcjohnson commentedon Apr 21, 2026
Thanks for the report! The default
tickformatworks fine, but~rand some of the other d3-format specs show this behavior.In this case the behavior is clearly a bug, since you didn't specify
tick0so it defaults to0therefore it's unambiguous that the tick should be exactly at zero. And we could make a narrow fix that says "if the tick value is close totick0(much closer than whatever we've calculated asdtick), set it to exactlytick0. That would cover the 99% use case.The one case it wouldn't cover is if someone sets a nonzero
tick0but there's still a tick that should fall exactly on zero. Liketick0=1anddtick=0.1. If we wanted to ensure we're robust in that situation, but still allow things that are not quite that to honor the user's intent liketick0=1.0001anddtick=0.1, we'd need some sort of heuristic for how close to zero, as a fraction ofdtick, counts as zero. One millionth? One billionth?camdecoster commentedon Apr 22, 2026
Thanks for the report! This does indeed look like a bug. Our team likely won't have time to address this for a while, but can prioritize a PR review if you want to look into it.
Snap near-zero tick values to tick0 to fix float artefacts in labels