Skip to content

ENH: LogLocator can auto-select number of ticks based on axis #7126

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
Sep 19, 2016

Conversation

efiring
Copy link
Member

@efiring efiring commented Sep 17, 2016

Closes #6549 and #7001. It doesn't actually address all cases
noted in #6549, but I think this is as far as we are prepared to go
any time soon.

Closes matplotlib#6549 and matplotlib#7001.  It doesn't actually address all cases
noted in matplotlib#6549, but I think this is as far as we are prepared to go
any time soon.
@efiring efiring added this to the 2.0 (style change major release) milestone Sep 17, 2016
@@ -1799,6 +1806,14 @@ def __call__(self):
return self.tick_values(vmin, vmax)

def tick_values(self, vmin, vmax):
if self.numticks == 'auto':
if self.axis is not None:
numticks = max(min(self.axis.get_tick_space(), 9), 2)
Copy link
Member

Choose a reason for hiding this comment

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

I understand the minimum of 2, but 9 seems a bit of a random number. Why was this chosen?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, it is pretty random. It is the default max we chose for the MaxNLocator auto algorithm, so I used it here as well. The rationale in both cases is that plots just don't look good with a huge number of major ticks; so 9 is random, but it "seems reasonable" as a limit. Nothing prevents a user from specifying a larger number instead of using the auto algorithm.

@NelleV
Copy link
Member

NelleV commented Sep 19, 2016

Thanks for the patch. This looks good to me 👍

@tacaswell tacaswell merged commit 6741ddf into matplotlib:v2.x Sep 19, 2016
@tacaswell
Copy link
Member

@efiring Can you add a note about this to #6994 ?

efiring added a commit to efiring/matplotlib that referenced this pull request Sep 21, 2016
@efiring efiring deleted the logauto branch October 24, 2021 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants