-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
subcoordinate_y: respect ylim
#6190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Let's dive more into the zoom UX with subcoord-y overlays! By default, the user gets global import holoviews as hv
import numpy as np
hv.extension('bokeh')
x = np.linspace(0, 10*np.pi)
curves = [
hv.Curve((x + i*np.pi/2, np.sin(x)), label=f'Line {i}').opts(
subcoordinate_y=True,
)
for i in range(3)
]
hv.Overlay(curves).opts(show_legend=False) Users can add curves = [
hv.Curve((x + i*np.pi/2, np.sin(x)), label=f'Line {i}').opts(
subcoordinate_y=True, tools=['zoom_in', 'zoom_out'],
)
for i in range(3)
]
hv.Overlay(curves).opts(show_legend=False) ![]() A little detour on a normal overlay behavior: it is not possible to directly add global tools to an overlay. This seems to be unrelated to subcoord-y. overlay = hv.Curve([-1, -2, -3]) * hv.Curve([1, 2, 3])
overlay.opts(tools=['zoom_in'])
# No zoom_in tool! ![]() For normal overlays, the usual workaround, I think, is to directly add a tool to a least one element of the overlay. overlay = hv.Curve([-1, -2, -3]) * hv.Curve([1, 2, 3]).opts(tools=['zoom_in'])
overlay ![]() This workaround doesn't work with subcoord-y overlays, it will not add a global from bokeh.models import WheelZoomTool
curves = [
hv.Curve((x + i*np.pi/2, np.sin(x)), label=f'Line {i}').opts(
subcoordinate_y=True, tools=[WheelZoomTool()],
)
for i in range(3)
]
hv.Overlay(curves).opts(show_legend=False, ylim=(0, 1)) With grouped subcoord-y overlays, the same issues and workaround apply. Except that, at least at the moment, there are more zoom tools in the toolbar. curves = [
hv.Curve((x + i*np.pi/2, np.sin(x)), group=group, label=f'{group} Line {i}').opts(
subcoordinate_y=True, tools=[WheelZoomTool()],
)
for group in 'ABC'
for i in range(3)
]
hv.Overlay(curves).opts(show_legend=False, ylim=(0, 1)) In conclusion:
My take on these:
cc @droumis some food for thought |
Co-authored-by: Philipp Rudiger <prudiger@anaconda.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6190 +/- ##
==========================================
- Coverage 88.70% 87.55% -1.15%
==========================================
Files 314 319 +5
Lines 65993 67167 +1174
==========================================
+ Hits 58537 58808 +271
- Misses 7456 8359 +903
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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. |
Fixes #5952
I want to wait for #6122 to be merged to fully set this PR. At the moment I think you can't zoom-out from the
ylim
which isn't good.