Conversation

alexcjohnson

Gives you the ability to disable certain modebar buttons for an axis, without otherwise impacting the interactivity of that axis. This is useful for example if you have one axis with data over a very broad range (like a time series, or in my case, data down a several-thousand-meter drill hole) and the opposite axes have a relatively limited, well-defined range that you don't need to change much.

I made this attribute as a flaglist, mostly for future expansion if needed since there are only two flags right now: auto sets whether the autorange button affects this axis, and inout sets whether the zoom in / zoom out buttons affect this axis. You can also use all (default) and none as shorthands.

@gvwilsongvwilson requested a review from emilykl February 10, 2025 14:49
@gvwilsongvwilson added featuresomething newP1needed for current cyclelabels Feb 10, 2025
@emilykl

@alexcjohnson It's not entirely clear to me how to think about which buttons are intended to be included/excluded by these options. The most extreme interpretation of, say, inout would seem to be that every other modebar button besides zoomin / zoomout has no effect on that axis -- including e.g. zoom, pan, boxselect. I'm not sure that's a desired behavior (and that's not the behavior of your PR) -- but how can we clarify to the user that buttons like zoom and pan are not affected by this flag? Feel free to let me know if I'm thinking about this the wrong way.

Also a few thoughts on naming —

auto is a bit confusing to me as it makes me think of "automatically choose which modebar buttons affect this axis" rather than "autoscale". How about simply autoscale?

Maybe zoominout rather than inout as well?

@alexcjohnson

Good point. Maybe this would be clearer as a container with booleans in it, rather than a flaglist? That would also be more extensible, since those booleans could default to true which you can't do with a flaglist. This would work with a flaglist of buttons to disable, but that seems even more confusing.

So perhaps:

modebarbuttons: {
    autoscale: false,
    zoominout: false
}

That's more verbose when you want to disable both, but seems clearer about exactly what it applies to. Thoughts?

@archmoj

Very useful feature. Thanks @alexcjohnson.
Since this feature only involves zoom interactions, I was wondering if ax.zoom may be a better attribute name instead of ax.modebarbuttons?

@emilykl

Hi @alexcjohnson ! Revisiting this one because we'd love to get it into the next minor release.

Taking another look at the diff, I noticed there's an existing axis property called fixedrange. How would that interact with the modebarbuttons property? Is the difference that fixedrange disables ALL zooming (i.e. via box select) and e.g. modebarbuttons: 'none' would disable only zooming which is triggered by clicking on the modebar buttons, but box select zoom would still be allowed?

@alexcjohnson

Since this feature only involves zoom interactions, I was wondering if ax.zoom may be a better attribute name instead of ax.modebarbuttons?

I think ax.zoom would be too broad in other ways - like as @emilykl points out there's also ax.fixedrange, ax.zoom='none' kind of implies there's NOTHING you can do to zoom in or out. And @emilykl yes your understanding is correct, the goal here is just to give more control over what the zoom & autorange modebar buttons do, while still allowing you to adjust the range of this axis in other ways, ie box zoom or dragging on the axis ends.

Perhaps ax.modebarzoom would be a more precise name?

@emilykl

Perhaps ax.modebarzoom would be a more precise name?

So ax.modebarzoom would be a boolean, where true (default) means the current behavior (no change), and false means that both the autorange and zoom in/out buttons do not affect this axis? That seems reasonable to me.

Or do you mean ax.modebarzoom as a flaglist? IMO if we go the flaglist route, the flags need to be just the names of the modebar buttons themselves, otherwise there's too many arbitrary flag names and it's difficult to keep track of which buttons they affect. On the other hand, the concept of "disabling" a button for an axis isn't meaningful for all button types (e.g. what would that mean for drawrect?) so button-by-button might open up some confusing possibilities. I suppose we could support just a subset of button types though, and ignore the others.

edit: on rereading your earlier post @alexcjohnson, I guess ax.modebarbuttons as a flaglist or a dict of buttonName: boolean is roughly equivalent, it's just a question of naming. Maybe a flaglist called ax.modebardisable?

Sign up for free to join this conversation on . Already have an account? Sign in to comment
featuresomething newP1needed for current cycle
None yet

Successfully merging this pull request may close these issues.