-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Minor ticklabels are missing at positions of major ticks. #13618
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
Comments
There is no minor tick there anymore so there won’t be a label. What’s wrong w putting the HH:MM in the major label? |
Actually, I don't think there is anything wrong with that. It's more that the previous code suddenly broke. Was this an intentional change? |
Yes though I’m on my phone and can’t look up the PRs. Recent ones by @anntzer and or myself. Basically minor ticks no longer include major ticks. So no more over strike on the ticking and no more heuristic guessing if a labeled minor tick is really a major tick. |
Yes, that comes from #13314. I guess this could have been better documented; on the other hand the issue that #13314 fixed did keep coming up again and again, so trying to play whack-a-mole by fixing it one locator at a time is a bit an endless task. Note that in the example here, your formatters are actually not really independent from one another (you need to embed the newline in the major formatter), so I think the solution with the new API ( |
I see. Now reading the API change note, "Minor Locator no longer try to avoid overstriking major Locators", it seems to tell me the opposite, because obviously the minor locator does avoid the major locations. May I suggest to write an additional what's new entry that is understandable by normal people and shows what is changed and why that is? |
Do you want to give it a try? You are obviously more aware of the cases that have been broken. (If not I'll do it, that's fine too.) |
Is there any way to revert back to the old behaviour? |
Right now, no. Could perhaps be switched with a new flag (with the note that in that case, even loglocators don't try to avoid crashing minor and major ticks). |
For a what's new entry maybe show the effect as follows:
I mean this really looks like a great improvement, but maybe someone relies on the major and minor ticks/grids overlapping? |
I think a what's new entry would still be useful, since noone reads API change notes. (Reading through the recent API changes actually a lot of them should have been mentionned in the what's new section?! Or maybe I don't quite understand the difference between what's new and API change notes?) Also, how do you revert this change? Previously you could still write your own ticker in order not to tick some locations. Arguably, the new behaviour is much better for most standard cases. However for special cases, with this change, you cannot write any ticker to force a tick at a specific location if it happens to be part of the major ticks. Not even a Concrete example:
now: Question: How to get the gridline back? |
I’m not opposed to having a way to get all the ticks back, but I’m not clear on what the practical problem is versus a theoretical one. If you need a bunch of vertical lines at arbitrary locations axvline does that for you. This makes all the practical cases much better at the cost of a few obscure cases being a bit harder. I’d need a bit more to convince me that adding API to toggle this behaviour is worth the fuss. I think what’s new is for new features. API changes is for changes to existing features. At least in my mind. OTOH Id support merging these two under what’s new and just labelling the API changes as such. |
That is a theoretical problem indeed. You type something in (
Sure, there is no need for
I think I would argue that things like "Hey look, we've fixed this long standing bug." or "If you use good old command |
Thats correct - #13314 says that minor ticks are exclusive of major ticks by definition, so if you ask to put a minor tick where a major tick is, you won't get it. I'm still not clear what the use-case is, but if you need to hack around this definition:
though I note that going more decimal places (0.20001) excludes the tick, which seems a bit too much slop... (well, its |
On my phone but note that #11575 is close to (though not exactly) the opposite of what @ImportanceOfBeingErnest mentioned above: users were complaining that set_xticks did not cause the minor ticks to be excluded from colliding locations. |
The fact that log scales use major and minor locators is more an implementation detail, #11575 could be solved differently as well. In general, I'm not at all opposing the default Locators to exclude minor ticks at major tick positions. If the decision is indeed to redefine the notions of major and minor in the sense of "minor ticks are exclusive of major ticks by definition", that is a major change in the semantics and a "What's new" entry is the very least one needs for that. |
I don't mind moving/duplicating the api_changes to the whatsnew. |
By "default" I meant all those cases where the user does not type in The best would be an opt-out option for this behaviour. (But I currently wouldn't know where to put that. In the locators? In the axes?) |
But all #11575 is a case where the user uses set_xticks but wants collision suppression...
The real fix would be to allow text objects with variable color or size (I mean, here you can have two different colors (major/minor) but not three, so that's clearly a hack). Can you open a PR to add whatever note you want to the api_changes and possibly move it to the whatsnew? I think we should try to keep this as is, and, if there's too much pushback against it, we can consider adding the opt-out in a future release. |
No sorry, I can't. I did try and it came out too sarcastic to be publishable. |
Do you want to block 3.1 over that? (That's fine with me, but you need to ask for it :)) |
No, I don't want to block 3.1 over this. I gave some arguments above, and if they are not shared by others, I might simply be wrong in my analysis. |
OK, let's just ping @tacaswell to get his opinion as well then, if he wants to chime in before the 3.1 release. |
Suggest we add to tomorrow’s agenda. |
Discussed on call Primary plan is to try to add a public API for controlling the de-confliction |
If Axis.remove_overlapping_locs is set to False the `Axis` object will not attempt to remove locations in the minor ticker that overlap with locations in the major ticker. This is a follow up to matplotlib#13314 which un-conditionally removed the overlap. closes matplotlib#13618
Sorry to bring up a long closed thread, but is there a way for the user to reverse this change? I think this is a much more natural way of displaying time series data, since when people refer something happening in "2023" or in "March 2023", they mean over a time period. Plotting it this way makes that super easy to find (imo). My code for doing this is;
Apologies if this is not the right forum for this, but if I can get Matplotlib to show exactly what @ImportanceOfBeingErnest did in the first post, I can get this to work. |
Bug report
Bug summary
Minor ticklabels are missing at positions of major ticks.
Code for reproduction
Actual outcome
The above code run with current master produces
The minor ticklabels showing the
00:00
hours are missing.Expected outcome
The expected outcome would be the same as when running the code with matplotlib 3.0.2 or below:
I would expect to see the hours throughout.
Matplotlib version
print(matplotlib.get_backend())
): anyThe text was updated successfully, but these errors were encountered: