-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: do not always reset scales from figureoptions #6281
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
Conversation
Only try to set the axis scales if they have been changed. closes matplotlib#6276 The `set_yscale` and `set_xscale` Axes methods call out to `Axis_set_scale` which resets the default locator/formatters (which makes sense when flipping between log/linear). Putting the cut-out in `figureoption` is the less disruptive change, even if the case could be made that the no-op short-circuit should be done in Axis or Axes.
@anntzer Can you review this? |
The remaining issue is that the formatting is lost after changing the scale from linear to log and back to linear again. Intuitively I feel like scale objects should be cached (most likely in a name->scale dict attached to the axis object) so that formatting is not lost... but perhaps this would be overengineering it? (Also, one would need a way to bypass the cache, most likely by passing an explicit scale object to set_scale.) |
That definitely feels like overengineering to me. If someone did want to keep track of the full history of the formatters/locators then it should live in a layer above base mpl. |
My gut feeling/expectation is that after creating a figure programatically, any changes done to it from the figure options UI should be reversible, which is why I proposed the scale object cache. Where to put the no-op check comes down to what behavior you expect for something like
Ignoring the implementation right now, what do you think about this? |
@tacaswell this appears to be waiting on feedback from you. |
I would expect that given a set of artists on in the axes One thing that will help here is once we have traitlets, setting the default values of the properties on the LogFormatter and LogLocator will be easy. |
That's fair. In this case, I'd suggest a comment in the definition of |
Only try to set the axis scales if they have been changed. closes matplotlib#6276 The `set_yscale` and `set_xscale` Axes methods call out to `Axis_set_scale` which resets the default locator/formatters (which makes sense when flipping between log/linear). Putting the cut-out in `figureoption` is the less disruptive change, even if the case could be made that the no-op short-circuit should be done in Axis or Axes. Closes matplotlib#6281
Only try to set the axis scales if they have been changed.
closes #6276
The
set_yscale
andset_xscale
Axes methods call out toAxis_set_scale
which resets the default locator/formatters (whichmakes sense when flipping between log/linear).
Putting the cut-out in
figureoption
is the less disruptive change,even if the case could be made that the no-op short-circuit should be
done in Axis or Axes.