-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: make sure we have more than 1 tick with small log ranges #18754
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2479,6 +2479,13 @@ def tick_values(self, vmin, vmax): | |
if mpl.rcParams['_internal.classic_mode'] else | ||
(numdec + 1) // numticks + 1) | ||
|
||
# if we have decided that the stride is as big or bigger than | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really the right solution to the original problem? To me, it seems that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you are very narrow, there's no good solution. Either you have only one tick, which makes your scale uninterpretable. Or you have overlap. 🤷 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, let me rephrase: We clip numticks to 2, so why don't we have 2 ticks? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The issue is that based on I think that this fix (which fixes the values after doing a bunch of heuristics) is a better and more reliable fix than making the heuristics more complicated. |
||
# the range, clip the stride back to the available range - 1 | ||
# with a floor of 1. This prevents getting axis with only 1 tick | ||
# visible. | ||
if stride >= numdec: | ||
stride = max(1, numdec - 1) | ||
|
||
# Does subs include anything other than 1? Essentially a hack to know | ||
# whether we're a major or a minor locator. | ||
have_subs = len(subs) > 1 or (len(subs) == 1 and subs[0] != 1.0) | ||
|
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.
@tacaswell There seems to be a clear typo in the test here: you don't do anything with
ticks
, and the assert is the same on each loop iteration. Do you remember what you intended to do?