Skip to content

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

Merged
tacaswell merged 1 commit into
matplotlib:v2.xfrom
efiring:logauto
Sep 19, 2016
Merged

ENH: LogLocator can auto-select number of ticks based on axis#7126
tacaswell merged 1 commit into
matplotlib:v2.xfrom
efiring:logauto

Conversation

@efiring

@efiring efiring commented Sep 17, 2016

Copy link
Copy Markdown
Member

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
Comment thread lib/matplotlib/ticker.py
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
Copy Markdown
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
Copy Markdown
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

NelleV commented Sep 19, 2016

Copy link
Copy Markdown
Member

Thanks for the patch. This looks good to me 👍

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

Copy link
Copy Markdown
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