Problem with bokeh.events.Tap

Hi,

I’ve encountered a strange problem (actually two problems) when using Tap from bokeh.events (with the bokeh server).

In example 1 below, the Tap event works but also seems to work outside the right hand side of the plot area, up to the edge of the toolbar. If you click within the toolbar, the controls work, but it also updates the plot. You can also click below the toolbar and the plot updates.

In example 2 below (the plot appears after the button is pressed), the toolbar disappears when the plot (or toolbar) is tapped.

Does anyone know what’s going on?

Thanks,
Marcus.

Example 1

···

from bokeh.models.sources import ColumnDataSource
from bokeh.plotting import Figure
from bokeh.io import curdoc
from bokeh.events import Tap

fig = Figure()
line_src = ColumnDataSource(data={‘x’: [0, 1], ‘y’: [0, 1]})
line = fig.line(‘x’, ‘y’, source=line_src)

def update_data(event):
line_src.data[‘x’][1] = event.x
line_src.data[‘y’][1] = event.y
fig.renderers.remove(line)
fig.renderers.append(line)

fig.on_event(Tap, update_data)

curdoc().add_root(fig)

``

Example 2

from bokeh.models.sources import ColumnDataSource
from bokeh.models.layouts import Column, WidgetBox
from bokeh.models.widgets import Button, Div
from bokeh.plotting import Figure
from bokeh.io import curdoc
from bokeh.events import Tap

fig = Figure()
line_src = ColumnDataSource(data={‘x’: [0, 1], ‘y’: [0, 1]})
line = fig.line(‘x’, ‘y’, source=line_src)

def update_data(event):
line_src.data[‘x’][1] = event.x
line_src.data[‘y’][1] = event.y
fig.renderers.remove(line)
fig.renderers.append(line)

fig.on_event(Tap, update_data)

def update_plot():
gui.children[1] = fig

btn = Button(label=‘Click to plot’)
btn.on_click(update_plot)
gui = Column(WidgetBox(btn), Div())

curdoc().add_root(gui)

``

Hi all,

I’m still stuck on this, any ideas much appreciated. If it helps, both examples worked in 0.12.10 but stopped working in 0.12.11, so presumably it’s either a bug or something’s changed in Bokeh and I haven’t changed my code accordingly. I’ll raise a GH issue if it’s a bug but wanted to check here first.

Thanks,
Marcus.

Hi Marcus,

This definitely seems like a bug (or possibly two) so the next best step would be a GH issue with these MREs. Unfortunately I don't have any workarounds to suggest at present.

Thanks,

Bryan

···

On Dec 19, 2017, at 08:53, Marcus Donnelly <[email protected]> wrote:

Hi,

I've encountered a strange problem (actually two problems) when using Tap from bokeh.events (with the bokeh server).

In example 1 below, the Tap event works but also seems to work outside the right hand side of the plot area, up to the edge of the toolbar. If you click within the toolbar, the controls work, but it also updates the plot. You can also click below the toolbar and the plot updates.

In example 2 below (the plot appears after the button is pressed), the toolbar disappears when the plot (or toolbar) is tapped.

Does anyone know what's going on?

Thanks,
Marcus.

Example 1
--------------

from bokeh.models.sources import ColumnDataSource
from bokeh.plotting import Figure
from bokeh.io import curdoc
from bokeh.events import Tap

fig = Figure()
line_src = ColumnDataSource(data={'x': [0, 1], 'y': [0, 1]})
line = fig.line('x', 'y', source=line_src)

def update_data(event):
    line_src.data['x'][1] = event.x
    line_src.data['y'][1] = event.y
    fig.renderers.remove(line)
    fig.renderers.append(line)

fig.on_event(Tap, update_data)

curdoc().add_root(fig)

Example 2
--------------

from bokeh.models.sources import ColumnDataSource
from bokeh.models.layouts import Column, WidgetBox
from bokeh.models.widgets import Button, Div
from bokeh.plotting import Figure
from bokeh.io import curdoc
from bokeh.events import Tap

fig = Figure()
line_src = ColumnDataSource(data={'x': [0, 1], 'y': [0, 1]})
line = fig.line('x', 'y', source=line_src)

def update_data(event):
    line_src.data['x'][1] = event.x
    line_src.data['y'][1] = event.y
    fig.renderers.remove(line)
    fig.renderers.append(line)

fig.on_event(Tap, update_data)

def update_plot():
    gui.children[1] = fig

btn = Button(label='Click to plot')
btn.on_click(update_plot)
gui = Column(WidgetBox(btn), Div())

curdoc().add_root(gui)

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/fae97899-f6a7-4d87-8025-53823e9d3f01%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks Bryan, I’ll create a GH issue.

···

On 9 Jan 2018 6:42 pm, “Bryan Van de ven” [email protected] wrote:

Hi Marcus,

This definitely seems like a bug (or possibly two) so the next best step would be a GH issue with these MREs. Unfortunately I don’t have any workarounds to suggest at present.

Thanks,

Bryan

On Dec 19, 2017, at 08:53, Marcus Donnelly [email protected] wrote:

Hi,

I’ve encountered a strange problem (actually two problems) when using Tap from bokeh.events (with the bokeh server).

In example 1 below, the Tap event works but also seems to work outside the right hand side of the plot area, up to the edge of the toolbar. If you click within the toolbar, the controls work, but it also updates the plot. You can also click below the toolbar and the plot updates.

In example 2 below (the plot appears after the button is pressed), the toolbar disappears when the plot (or toolbar) is tapped.

Does anyone know what’s going on?

Thanks,

Marcus.

Example 1


from bokeh.models.sources import ColumnDataSource

from bokeh.plotting import Figure

from bokeh.io import curdoc

from bokeh.events import Tap

fig = Figure()

line_src = ColumnDataSource(data={‘x’: [0, 1], ‘y’: [0, 1]})

line = fig.line(‘x’, ‘y’, source=line_src)

def update_data(event):

line_src.data['x'][1] = event.x
line_src.data['y'][1] = event.y
fig.renderers.remove(line)
fig.renderers.append(line)

fig.on_event(Tap, update_data)

curdoc().add_root(fig)

Example 2


from bokeh.models.sources import ColumnDataSource

from bokeh.models.layouts import Column, WidgetBox

from bokeh.models.widgets import Button, Div

from bokeh.plotting import Figure

from bokeh.io import curdoc

from bokeh.events import Tap

fig = Figure()

line_src = ColumnDataSource(data={‘x’: [0, 1], ‘y’: [0, 1]})

line = fig.line(‘x’, ‘y’, source=line_src)

def update_data(event):

line_src.data['x'][1] = event.x
line_src.data['y'][1] = event.y
fig.renderers.remove(line)
fig.renderers.append(line)

fig.on_event(Tap, update_data)

def update_plot():

gui.children[1] = fig

btn = Button(label=‘Click to plot’)

btn.on_click(update_plot)

gui = Column(WidgetBox(btn), Div())

curdoc().add_root(gui)

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/fae97899-f6a7-4d87-8025-53823e9d3f01%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/0B1A6ABB-E9E4-45D8-82C0-BB025AEB3AF9%40anaconda.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.