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

Better log axis tick labeling with less label overlap for scatter plots #6120

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jensb
Copy link

@jensb jensb commented Feb 15, 2022

Swap small single-digit subtick labels with normal-size multi-digit labels, but only at positions 2, 3, 5 and 7 to avoid text overlapping, and depending on subtick text length.

Details see https://stackoverflow.com/questions/70926979

animation

@jensb
Copy link
Author

jensb commented Feb 15, 2022

The patch changes the default behaviour of tick labeling and so breaks some tests. I would actually prefer introducing a new tickformat, e.g. "D3", to show this behaviour and not break existing behaviour. But to implement that is beyond my abilities ... any help?

@jensb
Copy link
Author

jensb commented Mar 9, 2022

Any comments, progress, review?
Anything I need to do to help merging this?
Yes, there are some failing tests, but this is obviously because I am (slightly) changing Plotly's behaviour, intentionally ... for the better, I hope.

@alexcjohnson
Copy link
Collaborator

Hi @jensb - thank you, this is definitely a mode a lot of people will like! But it's a big enough change that I don't think we can make it the default without a major version bump. I'd like to propose we add a new attribute like ax.loglabels (name and values open for discussion) that would default to 'small digits' (the current behavior) but also support 'full value' (your addition here). This way we would still automatically switch between linear tick labels, D1, D2, and 1 or more complete orders of magnitude as the axis range changes - your changes apply to both D1 and D2 modes in this evolution.

Also two issues I notice:

  • In your gif above you can see that the 1's are shifted down still - this shift should be removed.
  • We'll need to figure out how to implement this a little deeper in the stack, without altering tickformat or hoverformat - because users will still want to use those, at least hoverformat.

Thanks for kicking this off, and apologies for the slow review!

@jensb
Copy link
Author

jensb commented Mar 9, 2022

Thank you!
Yes, I fully agree with all your comments, and I'd be happy to review / test any patches and also help with development. To start this by myself I may need some guidance though.
I also tried to make the 1s bold instead of shifting them down which would increase usability further, but my attempts didn't work.
BTW it seems Github has a maximum allowed frame count for GIFs, the uncut GIF is on Stackoverflow, there you can see how my Patch acts when zooming further in.

@alexcjohnson
Copy link
Collaborator

Adding an attribute is fairly easy, but you need to know where to do what. First the attribute needs to be defined, this one should probably go somewhere around here. Then in the supplyDefaults step we need to set that attribute only when it applies - that would be next to this block with the condition if(axType === 'log')

At that point you can use it, and I think the file you've already been working in is the only one you'll need to change.

After that we'll want some tests, but we can talk about that later :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants