Skip to content

Rework MaxNLocator, eliminating infinite loop; closes #6849 #6919

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 3 commits into from
Aug 22, 2016

Conversation

efiring
Copy link
Member

@efiring efiring commented Aug 7, 2016

The core algorithm has been reimplemented in a more compact and understandable form than my earlier try at adding the min_n_ticks constraint.

I replaced the images for one mplot3d test because I think the present behavior is more consistent than the earlier behavior that led to those images. In the replaced versions, all of the axes have ticks just slightly inside the limits. Based on the gallery it appears this is the intended behavior but @WeatherGod can confirm or deny this.

@efiring efiring added this to the 2.0 (style change major release) milestone Aug 7, 2016
@efiring
Copy link
Member Author

efiring commented Aug 8, 2016

Here also, the appveyor py 3.5 build failed early on; it's unrelated to this PR.

# Make an extended staircase within which the needed
# step will be found. This is probably much larger
# than necessary.
flights = (0.1 * np.array(self._steps[:-1]),
Copy link
Member

Choose a reason for hiding this comment

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

👍 to the naming

@anntzer
Copy link
Contributor

anntzer commented Aug 9, 2016

This leads to integer=True not being respected in the following case:

ax = gca(); ax.locator_params(integer=True); ax.set_xlim(-.1, 1.1)

(or the example in #6849) even though the ticker could very well just use the two ticks at the two integer values.

@efiring
Copy link
Member Author

efiring commented Aug 9, 2016

@anntzer you are correct with respect to your example; it is now fixed and works as I intended. The example in #6849, however, leaves room for only one integer tick, so it will relax the integer constraint (given the default min_n_ticks=2).

@tacaswell tacaswell merged commit b2a25b2 into matplotlib:master Aug 22, 2016
tacaswell added a commit that referenced this pull request Aug 22, 2016
ENH: Rework MaxNLocator, eliminating infinite loop; closes #6849
@tacaswell
Copy link
Member

backported to v2.x as 9982e40

@QuLogic QuLogic mentioned this pull request Dec 7, 2016
5 tasks
@efiring efiring deleted the integer_locator branch October 24, 2021 19:51
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