Skip to content

Instantly share code, notes, and snippets.

@burbma
Created November 3, 2016 16:08
Show Gist options
  • Select an option

  • Save burbma/1e902094665446d483c895a3182f67e8 to your computer and use it in GitHub Desktop.

Select an option

Save burbma/1e902094665446d483c895a3182f67e8 to your computer and use it in GitHub Desktop.
Bokeh default selected dot
Display the source blob
Display the rendered blob
Raw
import numpy as np
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource
from bokeh.io import output_notebook, show
# prepare some date
N = 300
x = np.linspace(0, 4*np.pi, N)
y0 = np.sin(x)
# NEW: create a column data source for the plots to share
source = ColumnDataSource(data=dict(x=x, y0=y0),
selected={'0d': {'glyph': None, 'indices': []},
'1d': {'indices': [N/2]},
'2d': {}})
TOOLS = "tap"
# create a new plot and add a renderer
p = figure(tools=TOOLS, width=350, height=350, title=None)
c = p.circle('x', 'y0', source=source)
# show the results
show(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment