Skip to content

Emit event when changing xscale/yscale #8439

Open

Description

@astrofrog

At the moment, changing xlim/ylim results in an xlim_changed/ylim_changed event being emitted, but there is nothing equivalent for changing xscale/yscale. Would it be possible to add this?

Activity

  1. WeatherGod commented on Apr 6, 2017

    @WeatherGod
    Member
  2. anntzer commented on Apr 7, 2017

    @anntzer
    Contributor

    Seems like something that should ultimately be subsumed by the move to traitlets -- if it ever happens :-)

  3. added this to the milestone on Apr 9, 2017
  4. modified the milestones: , on Sep 2, 2017
  5. github-actions commented on Apr 11, 2023

    @github-actions

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  6. added
    status: inactive
    on Apr 11, 2023
  7. tacaswell commented on May 12, 2023

    @tacaswell
    Member

    Notification of changes to the scale I think still makes sense as a wish-list item.

  8. added
    keep
    and removed
    status: inactive
    on May 12, 2023
  9. Luna-v0 commented on Jun 7, 2023

    @Luna-v0

    Hi, I had a thought about this issue and I was thinking on something like this

    def onchange_scale_x(self,func):
        __set_xscale = self.set_xscale
        def wrapper_xscale(*args,**kwargs):
            __set_xscale(*args,**kwargs)
            res = self.get_xscale()
            func(res)
        self.set_xscale = wrapper_xscale
    
    def onchange_scale_y(self,func):
        __set_yscale = self.set_yscale
        def wrapper_yscale(*args,**kwargs):
            __set_yscale(*args,**kwargs)
            res = self.get_yscale()
            func(res)
            
        self.set_yscale = wrapper_yscale

    these two functions overrides the definitions of set_yscale and set_xscale only to listen when they are called, would that be ok or should I do something different?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    New featurekeep

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions