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

Tap stream doesn't work with bokeh serve deployment #2231

Closed
kpalin opened this issue Dec 28, 2017 · 5 comments
Closed

Tap stream doesn't work with bokeh serve deployment #2231

kpalin opened this issue Dec 28, 2017 · 5 comments
Labels
tag: backend: bokeh type: bug Something isn't correct or isn't working
Milestone

Comments

@kpalin
Copy link

kpalin commented Dec 28, 2017

Have tried, and failed, to get Tap stream working on standalone holoviews/bokeh app. Tried to port the Tap example to bokeh serve deployed version but that doesn't work either. It seems that the tap events are not coming back to python side.

Below is the code that doesn't respond to clicks but shows the initial plot just fine. Without the last two lines, the code works fine on jupyter notebook. As a side note: datashader works fine, so some events get through to the server.

import pandas as pd
import numpy as np
import holoviews as hv
from holoviews import streams
hv.extension('bokeh', width=90)

hv.opts(
    "HeatMap [width=700 height=500 logz=True fontsize={'xticks': '6pt'}, tools=['hover'] xrotation=90] (cmap='RdBu_r')"
)
hv.opts(
    "Curve [width=375 height=500 yaxis='right'] (line_color='pink') {+framewise}"
)
# Declare dataset
df = pd.read_csv(
    'http://assets.holoviews.org/data/diseases.csv.gz', compression='gzip')
dataset = hv.Dataset(df, vdims=('measles', 'Measles Incidence'))

# Declare HeatMap
heatmap = hv.HeatMap(
    dataset.aggregate(['Year', 'State'], np.mean),
    label='Measles Incidence').select(Year=(1928, 2002))

# Declare Tap stream with heatmap as source and initial values
posxy = hv.streams.Tap(source=heatmap, x=1951, y='New York')


# Define function to compute histogram based on tap location
def tap_histogram(x, y):
    return hv.Curve(
        dataset.select(State=y, Year=int(x)),
        kdims='Week',
        label='Year: %s, State: %s' % (x, y))


hmap = heatmap + hv.DynamicMap(tap_histogram, kdims=[], streams=[posxy])

doc = hv.renderer('bokeh').server_doc(hmap)
doc.title = 'HoloViews Bokeh App'
@philippjfr philippjfr added tag: backend: bokeh type: bug Something isn't correct or isn't working labels Dec 28, 2017
@jlstevens
Copy link
Contributor

Thanks for reporting this. Definitely something to address before the next release.

@philippjfr
Copy link
Member

This turned out to be a very annoying one line bug, which I've now fixed in the PR referenced above.

@ahuang11
Copy link
Collaborator

Hi, I tried bokeh serve file.py with kpalin's code

import pandas as pd
import numpy as np
import holoviews as hv
from holoviews import streams
hv.extension('bokeh', width=90)

hv.opts(
    "HeatMap [width=700 height=500 logz=True fontsize={'xticks': '6pt'}, tools=['hover'] xrotation=90] (cmap='RdBu_r')"
)
hv.opts(
    "Curve [width=375 height=500 yaxis='right'] (line_color='pink') {+framewise}"
)
# Declare dataset
df = pd.read_csv(
    'http://assets.holoviews.org/data/diseases.csv.gz', compression='gzip')
dataset = hv.Dataset(df, vdims=('measles', 'Measles Incidence'))

# Declare HeatMap
heatmap = hv.HeatMap(
    dataset.aggregate(['Year', 'State'], np.mean),
    label='Measles Incidence').select(Year=(1928, 2002))

# Declare Tap stream with heatmap as source and initial values
posxy = hv.streams.Tap(source=heatmap, x=1951, y='New York')


# Define function to compute histogram based on tap location
def tap_histogram(x, y):
    return hv.Curve(
        dataset.select(State=y, Year=int(x)),
        kdims='Week',
        label='Year: %s, State: %s' % (x, y))


hmap = heatmap + hv.DynamicMap(tap_histogram, kdims=[], streams=[posxy])

doc = hv.renderer('bokeh').server_doc(hmap)
doc.title = 'HoloViews Bokeh App'

and I still experience the same issue as kpalin using the latest versions:
holoviews==1.9.2
bokeh==0.12.13

@philippjfr
Copy link
Member

Yes, it's still not released. v1.9.3 is long overdue! We'll aim to release by Monday.

@philippjfr philippjfr modified the milestones: v1.10, 1.9.3 Feb 10, 2018
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 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tag: backend: bokeh type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

4 participants