Skip to content
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

RangeToolLink doesn't work with overlays #4472

Closed
ahuang11 opened this issue Jun 11, 2020 · 4 comments · Fixed by #5881
Closed

RangeToolLink doesn't work with overlays #4472

ahuang11 opened this issue Jun 11, 2020 · 4 comments · Fixed by #5881
Labels
type: bug Something isn't correct or isn't working

Comments

@ahuang11
Copy link
Collaborator

import holoviews as hv
from holoviews import opts
from bokeh.sampledata.stocks import AAPL

aapl_df = pd.DataFrame({'open': AAPL['open'], 'close': AAPL['close']}, index=pd.to_datetime(AAPL['date']))
aapl_df.index.name = 'Date'

aapl_curve = aapl_df.hvplot('Date', 'close')
tgt = aapl_curve.relabel('AAPL close price').opts('Overlay', width=800, labelled=['y'], toolbar='disable')
src = aapl_curve.opts('Overlay', width=800, height=100, yaxis=None, default_tools=[])

RangeToolLink(src, tgt)

layout = (tgt + src).cols(1)
layout.opts(opts.Layout(shared_axes=False, merge_tools=False))

expected a tool to show up in the toolbar like that:
http://holoviews.org/gallery/demos/bokeh/timeseries_range_tool.html

@philippjfr philippjfr added the type: bug Something isn't correct or isn't working label Sep 2, 2020
@droumis
Copy link
Member

droumis commented Jun 15, 2023

Maybe I'm misunderstanding, but the comment does not include an overlay.

Here is an overlay version and workaround to get RangeToolLink working... You have to subselect a single element in the target plot rather than the overlay

import holoviews as hv
from holoviews import opts
from bokeh.sampledata.stocks import AAPL
import pandas as pd
import hvplot.pandas

aapl_df = pd.DataFrame({'open': AAPL['open'], 'close': AAPL['close']}, index=pd.to_datetime(AAPL['date']))
aapl_df.index.name = 'Date'

aapl_curve_close = aapl_df.hvplot('Date', 'close')
aapl_curve_open = aapl_df.hvplot('Date', 'open')
tgt = aapl_curve_close * aapl_curve_open

aapl_df['change'] = aapl_df['close'] - aapl_df['open']
src = aapl_df.hvplot('Date','change')

RangeToolLink(src, list(tgt.values())[0])


layout = (tgt + src).cols(1)
layout.opts(opts.Layout(shared_axes=False, merge_tools=False))

image

@droumis
Copy link
Member

droumis commented Jun 15, 2023

I'm adding this to the CZI project list, as I'd like the API to be improved to work with overlays without the workaround

@droumis
Copy link
Member

droumis commented Sep 18, 2023

closed by #5881

@droumis droumis closed this as completed Sep 18, 2023
@droumis droumis moved this from Todo to Done in CZI R5 neuro Jan 1, 2024
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants