Skip to content

Label log minor ticks if only one log major tick is drawn. #29054

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

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Oct 31, 2024

In general, avoiding axis with a single labeled tick seems to be a good idea. Previously, a log axis spanning from 4 to 60 would have its minor ticks unlabeled, LogFormatter making that choice based on the fact that the axis spans more than one decade (60/4>10). Instead, change the interpretation of the first item in minor_thresholds to label the minor ticks (by default) if there is only one (or zero) major tick drawn (as is the case for the above axis limits).

Closes #29050, but probably needs to be discussed as that's technically an API break. However, note that this doesn't break any test and I suspect that this case may have been missed previously (I added a test for it).

PR summary

PR checklist

@anntzer
Copy link
Contributor Author

anntzer commented Dec 15, 2024

Bumping, at least for discussion?

@oscargus
Copy link
Member

I think it makes sense for the default behavior! I do not fully understand the consequences if someone provides a value, though, and therefore how "much breaking" this is.

Copy link
Contributor

@greglucas greglucas left a comment

Choose a reason for hiding this comment

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

This makes sense to me and seems like a sensible change to the default.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

IMHO the change is ok, even though it's technically breaking. I doubt somebody is explicitly relying (or wanting) the preivious behavior.

In general, avoiding axis with a single labeled tick seems to be a good
idea.  Previously, a log axis spanning from 4 to 60 would have its minor
ticks unlabeled, LogFormatter making that choice based on the fact that
the axis spans more than one decade (60/4>10).  Instead, change the
interpretation of the first item in `minor_thresholds` to label the
minor ticks (by default) if there is only one (or zero) major tick drawn
(as is the case for the above axis limits).
@timhoffm timhoffm added this to the v3.11.0 milestone Dec 17, 2024
@QuLogic QuLogic merged commit 9db1b97 into matplotlib:main Dec 19, 2024
39 checks passed
@anntzer anntzer deleted the lmt branch December 19, 2024 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants