Skip to content

Allow to zoom secondary ranges/scales independently #13049

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 9 commits into from
Jun 9, 2023

Conversation

mattpap
Copy link
Contributor

@mattpap mattpap commented Apr 3, 2023

This is functionally ready. This PR allows for wheel zoom of individual axes (zoom_on_axis="individual") and on linked (or perhaps a better term is cross) axes (zoom_on_axis="individual_linked"). The original behavior of zoom_on_axis with a boolean value is left unchanged. Additionally ZoomInTool and ZoomOutTool can be configured with renderers, which are used to determine which ranges will be affected by zoom:

This example shows WheelZoomTool(zoom_on_axis="individual"), and ZoomInTool and ZoomOutTool configured with a single renderer:

Screencast_00001.mp4

TODO:

  • fix unit tests
  • add tests for the new behavior

fixes #12829

@mattpap mattpap added this to the 3.2 milestone Apr 3, 2023
@bryevdv
Copy link
Member

bryevdv commented Apr 3, 2023

What are you envisioning for the API / properties (independent vs synced will need to be configurable somehow)?

@codecov
Copy link

codecov bot commented Apr 3, 2023

Codecov Report

Merging #13049 (e09eb3e) into branch-3.2 (8f38eeb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           branch-3.2   #13049   +/-   ##
===========================================
  Coverage       92.43%   92.43%           
===========================================
  Files             315      315           
  Lines           20072    20078    +6     
===========================================
+ Hits            18554    18560    +6     
  Misses           1518     1518           

@mattpap mattpap force-pushed the mattpap/12829_independent_zoom branch from 8b28b7b to 9029e2d Compare April 19, 2023 09:05
@mattpap mattpap force-pushed the mattpap/12829_independent_zoom branch from 9029e2d to 05cbfa6 Compare May 3, 2023 12:04
@mattpap mattpap force-pushed the mattpap/12829_independent_zoom branch 3 times, most recently from 52b566b to ddfc933 Compare May 29, 2023 10:23
@mattpap mattpap requested a review from jlstevens May 29, 2023 10:29
@mattpap mattpap force-pushed the mattpap/12829_independent_zoom branch from ddfc933 to 4f1e2bb Compare May 30, 2023 09:26
@jlstevens
Copy link
Contributor

Thanks!

I'll test out and review the functionality shortly.

@jlstevens
Copy link
Contributor

jlstevens commented Jun 6, 2023

I've done some initial tests and it seems to be working great!

@mattpap My main worry is that I really would love to see this is 3.2!

@mattpap mattpap force-pushed the mattpap/12829_independent_zoom branch from 4f1e2bb to d6a4924 Compare June 8, 2023 17:08
@mattpap
Copy link
Contributor Author

mattpap commented Jun 8, 2023

Unit tests are update. I still need to finish new tests.

@ianthomas23
Copy link
Member

I've only had a quick look and I can review properly tomorrow. But my first observation is that if I use "individual_linked" in the example then I not seeing any different behaviour. Perhaps I am misunderstanding the difference here. Anyway, is it possible to post a video of the different behaviour to make it clearer?

@bryevdv
Copy link
Member

bryevdv commented Jun 8, 2023

"individual_linked" is definitely not evocative to me, I had to go look into the code more closely. IIUC these are the cases:

  • False — nothing zooms
  • True — every axis zooms together
  • individual — just the one single axis zooms independently of anything else
  • individual_linked — the one axis and its "partner" axis in the frame zoom together, but independently of anything else.

If we keep this then I think "individual_frame" would be more comprehensible. But I'm also not averse to splitting these dimensions into more properties. i.e. zoom_on_axis stays a simple bool and controls whether there is any zooming at all, and some separate enum property or property control the behaviour, if zooming is turned on. I think that might be cleaner.

E.g. just spitballing, zoom_together = "none" | "frame" | "all" where "none" would just zoom the one axis itself and nothing else, "frame" would also zoom the "cross" axis for the frame, and "all" would be the current "link everything" behavior.

@jlstevens
Copy link
Contributor

jlstevens commented Jun 9, 2023

I don't have any strong opinions on this but I think a new property might indeed be slightly cleaner as there are two behaviors here: 1. whether to have per-axis zooming at all 2. how this links to other axes when enabled. Even if a new property is not introduced, I do agree that "individual_linked" doesn't convey much to me either.

As the word 'linked' has already been used (and is somewhat intuitive to me), how about a property called zoom_linking (or similar)? The options @bryevdv suggest for this property seems reasonable to me!

@mattpap
Copy link
Contributor Author

mattpap commented Jun 9, 2023

@jlstevens, would you prefer to test this in holoviews as-is or wait for this PR to be refined?

@jlstevens
Copy link
Contributor

jlstevens commented Jun 9, 2023

@mattpap I assume the tweaks suggested to the API won't change the behavior at all: I'm happy to test with whichever API in holoviews and the sooner the better!

If my assumption is wrong and you think the available set of behavior will change, then in that case, I think it would be best to wait.

@mattpap
Copy link
Contributor Author

mattpap commented Jun 9, 2023

  • with individual_linked (both axes either red or blue zoom):
Screencast_00000.mp4
  • with individual (only a single axis in the given dimension either red or blue zooms; cross axis is unaffected):
Screencast_00001.mp4
  • with True (both red and blue axes in the given dimension zoom; cross axes are unaffected):
Screencast_00002.mp4

@mattpap mattpap force-pushed the mattpap/12829_independent_zoom branch from d6a4924 to e09eb3e Compare June 9, 2023 09:41
@mattpap
Copy link
Contributor Author

mattpap commented Jun 9, 2023

I updated the API, so that zoom_on_axis is left unchanged and new property zoom_together is added. I chose "cross" in favor of "frame". My proposal is to go ahead and merge this, to allow @jlstevens test this in holoviews. We can further refine the API before 3.2. I will separately add more tests for new features.

@mattpap
Copy link
Contributor Author

mattpap commented Jun 9, 2023

I will need some someone to approve this if the plan is sound.

@mattpap
Copy link
Contributor Author

mattpap commented Jun 9, 2023

Test failure is unrelated and fixed in PR #13190 (f5f44b9).

Copy link
Member

@ianthomas23 ianthomas23 left a comment

Choose a reason for hiding this comment

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

I updated the API, so that zoom_on_axis is left unchanged and new property zoom_together is added. I chose "cross" in favor of "frame". My proposal is to go ahead and merge this, to allow @jlstevens test this in holoviews. We can further refine the API before 3.2. I will separately add more tests for new features.

Thanks for the videos and expanded example, it is all much clearer to me. Functionality and code look fine to me, so let's proceed and, as you say, refine the API before 3.2.

@mattpap mattpap merged commit 77abfbf into branch-3.2 Jun 9, 2023
@mattpap mattpap deleted the mattpap/12829_independent_zoom branch June 9, 2023 10:19
Chiemezuo pushed a commit to Chiemezuo/bokeh that referenced this pull request Aug 27, 2024
* Allow to zoom secondary ranges/scales independently

* Add support for ZoomBaseTool.renderers

* Update basic/axes/twin_axes.py

* Allow to configure individual zoom_on_axis behavior

* Robustify and update unit tests

* Update WheelZoomTool's off-frame unit tests

* Unify WheelZoomTool's unit tests

* Refine the API of on-axis zooming

* Update twin_axes.py example
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Independent extra ranges in a single figure
4 participants