-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
Introduce max_auto_ticklabel_spacing!
for less jitter
#4607
Conversation
Benchmark ResultsSHA: 2c4b5db7e9bbc2f3cc0fe85316b2c95f45c93b01 Warning These results are subject to substantial noise because GitHub's CI runs on shared machines that are not ideally suited for benchmarking. |
I'm not sure how much is gained here vs just doing |
Well, as pointed out, the "exact" version is not really exact once you start zooming.
I guess we could use more attributes from the ticklabels, but replacing the text with n_chars? |
I didn't mean that it was useful for zooming specifically, just that it's purpose is an exact one (you wouldn't be able to pick the value it chooses for The How about a mode like |
That's not a bad idea :) |
Ok, I reverted most of my changes to |
max_auto_ticklabel_spacing!
for less jitter
space = tight_ticklabel_spacing!(ax.yaxis) | ||
return space | ||
spacing = tight_ticklabel_spacing!(ax.yaxis) | ||
# Needed to not reset to automatic... But still doesn't keep the value somehow? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are these commented out parts for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started debugging timed_ticklabelspace_reset
but couldn't figure out if it work as expected and what even expected means... setting ax.yticklabelspace = spacing
seems to help timed_ticklabelspace_reset
to have the correct prev values, but still didn't seem to work correctly, so I reverted it, but left the comment to not loose the thought.
Closing in favor of: #4642 |
To not have jitter in the axis when panning/zooming, we've been recommending to use
tight_ticklabel_spacing!
, which doesn't fully work to avoid jitter.n_tick_chars=automatic
totight_xticklabel_spacing!
whereautomatic
replicated the old behavior. With set to e.g. 5, it will allocate enough space for 5 chars of ticks, e.g. "0.001".timed_ticklabelspace_reset
to reset the tickspace less often when zooming around. But it also resets the tickspace back to automatic (this may be a bug?). In any case, when we want truly static ticks, this should not run at all/ To achieve this, I added a a new option to turn of the timed reset totight_ticklabel_spacing!
andAxis
.Open question: maybe this should be put in a new function, e.g.
static_tickspace!(ax, nchars)
?cc: @jkrumbiegel