Add nonsingular to the locator base class, and use it in set_*lim too.#13409
Merged
QuLogic merged 1 commit intomatplotlib:masterfrom Feb 11, 2019
Merged
Add nonsingular to the locator base class, and use it in set_*lim too.#13409QuLogic merged 1 commit intomatplotlib:masterfrom
QuLogic merged 1 commit intomatplotlib:masterfrom
Conversation
c86ce72 to
20d49f8
Compare
jklymak
approved these changes
Feb 11, 2019
Currently, some Locator subclasses define a nonsingular() method, which is used by autoscale_view() in case the autoscaling would return a degenerate interval, to expand the view limits; autoscale_view() falls back on a default in case the nonsingular() method does not exist. Move that default to the Locator base class. Also use that nonsingular() method when a degenerate interval is passed to set_xlim/set_ylim/etc., instead of always hardcoding the same linear expansion. (Semantically the correct place for this nonsingular() method is probably on the scale class rather than on the locator...) The changes to test_ticker are due to the fact that the default expansion is now by 5%, so there's no offset text anymore in the left=right=123 case (as it gets expanded to 116.85, 129.15).
QuLogic
approved these changes
Feb 11, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, some Locator subclasses define a nonsingular() method, which
is used by autoscale_view() in case the autoscaling would return a
degenerate interval, to expand the view limits; autoscale_view() falls
back on a default in case the nonsingular() method does not exist. Move
that default to the Locator base class.
Also use that nonsingular() method when a degenerate interval is passed
to set_xlim/set_ylim/etc., instead of always hardcoding the same linear
expansion.
(Semantically the correct place for this nonsingular() method is
probably on the scale class rather than on the locator...)
The changes to test_ticker are due to the fact that the default
expansion is now by 5%, so there's no offset text anymore in the
left=right=123 case (as it gets expanded to 116.85, 129.15).
e.g. for


xscale("log"); xlim(.1, .1)one used to getbut one now gets
(in both cases with the "Attempting to set identical left == right == 0.1 results in singular transformations; automatically expanding." warning).
May be worth doing the same on colorbars, but their locator isn't set yet when the expansion needs to be done :/
PR Summary
PR Checklist