-
-
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
Overlaying annotations on target plot breaks RangeToolLink #6010
Comments
hmmm... a simpler example works. so something about the original example code above is throwing things off... import holoviews as hv; hv.extension('bokeh')
from holoviews.plotting.links import RangeToolLink
from holonote.annotate import Annotator
import pandas as pd
annotator = Annotator({"Time": float}, fields=["category"])
annotations_df = pd.DataFrame({'start': [.5], 'end': [.7], 'category': ['demo']})
annotator.define_annotations(annotations_df, Time=("start", "end"))
annotations_overlay = annotator.get_element("Time")
target = hv.Curve([1, 2], kdims='Time')
target_overlay = (annotations_overlay * target)
source = hv.Curve([1, 2], kdims='Time')
RangeToolLink(source, target, axes=["x", "y"])
(target_overlay + source * annotations_overlay).opts(shared_axes=False).cols(1) Screen.Recording.2023-12-06.at.5.00.25.PM.mov |
Here is an MRE and some other examples that do not work. None of them is using HoloNote so I will move this issue to HoloViews. It seems like it is caused by import holoviews as hv
from holoviews.plotting.links import RangeToolLink
import pandas as pd
hv.extension("bokeh")
# Set up
curve_fn = lambda i: hv.Curve([i, i], kdims="Time", label=str(i)).opts(
subcoordinate_y=True
)
target = hv.Overlay([curve_fn(1), curve_fn(2)])
source = hv.Curve([1, 2], kdims="Time")
RangeToolLink(source, target, axes=["x", "y"])
# What HoloNote does behind the scene
annotations_overlay = hv.DynamicMap(lambda: hv.VSpans(([0], [1])))
target_overlay = annotations_overlay * target
# Other example 1 (does not work)
annotations_overlay = hv.DynamicMap(lambda: hv.VSpans(([0], [1])))
target_overlay = target * annotations_overlay
# Curve example 1 (does not work)
annotations_overlay = hv.DynamicMap(lambda: hv.Curve([0, 1]))
target_overlay = annotations_overlay * target
# Curve example 2 (does not work)
annotations_overlay = hv.DynamicMap(lambda: hv.Curve([0, 1]))
target_overlay = target * annotations_overlay
# Curve example 3 (does not work and seems to remove the link)
annotations_overlay = hv.Curve([0, 1])
target_overlay = target * annotations_overlay
# Final
(target_overlay + source).opts(shared_axes=False).cols(1) |
Just checking which of my issues are still valid. This is still a valid issue. |
@hoxbro , will you have a chance to look into this soon? It takes priority over scale bars, and it's right below the priority of finishing off the pandas index support to realize those performance gains 💪 . Hoping we can get all three completed by the end of March. |
I'm a little confused by a few of these MROs posted above. Going through them 1-by-1: # What HoloNote does behind the scene
annotations_overlay = hv.DynamicMap(lambda: hv.VSpans(([0], [1])))
target_overlay = annotations_overlay * target Behavior I'm seeing is that the range tool correctly links the x-axis. It's also linking the y-axis of the first subcoordinate Curve. I'm not sure that's necessarily expected but it's poorly defined behavior. Would we expect all sub-coordinate ranges to be linked here? # Other example 1 (does not work)
annotations_overlay = hv.DynamicMap(lambda: hv.VSpans(([0], [1])))
target_overlay = target * annotations_overlay This does work, but it's not specified correctly. Since the target and source now share the exact same x-dimension the ranges end up linked, you could therefore use The other cases are just variations of the first two. So the only real "issue" I see here is the behavior of the subcoordinate-y ranges. Do we expect all of them to be linked in these cases? I'd agree with that but it doesn't seem urgent since it's not needed for the CZI related tasks. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
ALL software version info
holonote 0.1.0
holoviews 1.18.1
Description of expected behavior and the observed behavior
Overlaying annotations on a target plot prevents the RangeToolLink in a source plot from updating the dimension in the unbounded dimension of the annotation. For instance, with x-range annotations, the y-dimension link is broken.
Complete, minimal, self-contained example code that reproduces the issue
Code
Screenshots or screencasts of the bug in action
Screen.Recording.2023-12-06.at.1.47.59.PM.mov
The text was updated successfully, but these errors were encountered: