☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Digitizing a plot

Community Support
rgranot
rgranot

Hi All,

I would like to be able to select a point on the plot, and be able to save that selection into a new variable (essentially, be able to save the selection of the hover tool, I think)

Any help would be much appreciated!

Thx

Roi

⌁   Link to post
Bryan
Bryan

Hi,

More information/context is needed. In python in a Bokeh App? In a CustomJS callback in a standalone document? Please describe what you are trying to accomplish more fully.

Thanks,

Bryan

···

On Jun 8, 2017, at 00:45, rgranot@bgu.ac.il wrote:

Hi All,

I would like to be able to select a point on the plot, and be able to save that selection into a new variable (essentially, be able to save the selection of the hover tool, I think)

Any help would be much appreciated!

Thx

Roi

--
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/1a5067f0-4e35-4273-981f-df9340c3d4ed%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
rgranot
rgranot

Hi Bryan,

I am using python 2.7 on Mac, through the ipython notebook or from scripts. I’ve installed Bokeh as a module. Not sure what to say about the CustomJS (fresh in Bokeh).

Here is a script that I’m using, I would like to point at a point and besides the details that hover is showing, I would like to click on a point and have its values been stored into a new variable.

Script:

‘’’ Present an interactive function explorer with slider widgets.

Scrub the sliders to change the properties of the sin curve, or

type into the title text box to update the title of the plot.

Use the bokeh serve command to run the example by executing:

bokeh serve sliders.py

at your command prompt. Then navigate to the URL

http://localhost:5006/sliders

in your browser.

‘’’

import numpy as np

from bokeh.io import curdoc

from bokeh.layouts import row, widgetbox

from bokeh.models import ColumnDataSource, TapTool

from bokeh.plotting import figure

from bokeh.events import ButtonClick

from bokeh.models import Button

from bokeh.io import show

from bokeh.models.widgets import TextInput

button = Button()

def callback(event):

print(‘Python:Click’)

Set up widgets

text = TextInput(title=“title”, value=‘my sine wave’)

Set up callbacks

def update_title(attrname, old, new):

plot.title.text = text.value

text.on_change(‘value’, update_title)

Set up data

N = 20

x = np.linspace(0, 4*np.pi, N)

y = np.sin(x)

source = ColumnDataSource(data=dict(x=x, y=y))

N2=N*10

Set up plot

plot = figure(plot_height=400, plot_width=950, title=“Distance, anomaly plot”,

tools=“tap,hover,crosshair,pan,reset,save,wheel_zoom,box_zoom,box_select,reset”,

x_range=[0, 4*np.pi], y_range=[-2.5, 2.5])

#plot.line(‘x’, ‘y’, source=source, line_width=3, line_alpha=0.6)

#plot.circle(‘x’, ‘y’, source=source, line_width=3, line_alpha=0.6)

plot.line(x, y, line_width=2)

plot.circle(x, y, fill_color=“white”, size=8)

show(plot, notebook_handle=True)

Many thanks!

Roi

···

On Friday, June 9, 2017 at 4:20:37 PM UTC+3, Bryan Van de ven wrote:

Hi,

More information/context is needed. In python in a Bokeh App? In a CustomJS callback in a standalone document? Please describe what you are trying to accomplish more fully.

Thanks,

Bryan

On Jun 8, 2017, at 00:45, rgr…@bgu.ac.il wrote:

Hi All,

I would like to be able to select a point on the plot, and be able to save that selection into a new variable (essentially, be able to save the selection of the hover tool, I think)

Any help would be much appreciated!

Thx

Roi

–
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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/1a5067f0-4e35-4273-981f-df9340c3d4ed%40continuum.io.

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

⌁   Link to post
rgranot
rgranot

Hi Bryan,

I am using python 2.7 on Mac, through the ipython notebook or from scripts. I’ve installed Bokeh as a module. Not sure what to say about the CustomJS (fresh in Bokeh).

Here is a script that I’m using, I would like to point at a point and besides the details that hover is showing, I would like to click on a point and have its values been stored into a new variable.

Script:

‘’’ Present an interactive function explorer with slider widgets.

Scrub the sliders to change the properties of the sin curve, or

type into the title text box to update the title of the plot.

Use the bokeh serve command to run the example by executing:

bokeh serve sliders.py

at your command prompt. Then navigate to the URL

http://localhost:5006/sliders

in your browser.

‘’’

import numpy as np

from bokeh.io import curdoc

from bokeh.layouts import row, widgetbox

from bokeh.models import ColumnDataSource, TapTool

from bokeh.plotting import figure

from bokeh.events import ButtonClick

from bokeh.models import Button

from bokeh.io import show

from bokeh.models.widgets import TextInput

button = Button()

def callback(event):

print(‘Python:Click’)

Set up widgets

text = TextInput(title=“title”, value=‘my sine wave’)

Set up callbacks

def update_title(attrname, old, new):

plot.title.text = text.value

text.on_change(‘value’, update_title)

Set up data

N = 20

x = np.linspace(0, 4*np.pi, N)

y = np.sin(x)

source = ColumnDataSource(data=dict(x=x, y=y))

N2=N*10

Set up plot

plot = figure(plot_height=400, plot_width=950, title=“Distance, anomaly plot”,

tools=“tap,hover,crosshair,pan,reset,save,wheel_zoom,box_zoom,box_select,reset”,

x_range=[0, 4*np.pi], y_range=[-2.5, 2.5])

#plot.line(‘x’, ‘y’, source=source, line_width=3, line_alpha=0.6)

#plot.circle(‘x’, ‘y’, source=source, line_width=3, line_alpha=0.6)

plot.line(x, y, line_width=2)

plot.circle(x, y, fill_color=“white”, size=8)

show(plot, notebook_handle=True)

Many thanks!

Roi

···

On Friday, June 9, 2017 at 5:14:06 PM UTC+3, rgr…@bgu.ac.il wrote:

Hi Bryan,

I am using python 2.7 on Mac, through the ipython notebook or from scripts. I’ve installed Bokeh as a module. Not sure what to say about the CustomJS (fresh in Bokeh).

Here is a script that I’m using, I would like to point at a point and besides the details that hover is showing, I would like to click on a point and have its values been stored into a new variable.

Script:

‘’’ Present an interactive function explorer with slider widgets.

Scrub the sliders to change the properties of the sin curve, or

type into the title text box to update the title of the plot.

Use the bokeh serve command to run the example by executing:

bokeh serve sliders.py

at your command prompt. Then navigate to the URL

http://localhost:5006/sliders

in your browser.

‘’’

import numpy as np

from bokeh.io import curdoc

from bokeh.layouts import row, widgetbox

from bokeh.models import ColumnDataSource, TapTool

from bokeh.plotting import figure

from bokeh.events import ButtonClick

from bokeh.models import Button

from bokeh.io import show

from bokeh.models.widgets import TextInput

button = Button()

def callback(event):

print(‘Python:Click’)

Set up widgets

text = TextInput(title=“title”, value=‘my sine wave’)

Set up callbacks

def update_title(attrname, old, new):

plot.title.text = text.value

text.on_change(‘value’, update_title)

Set up data

N = 20

x = np.linspace(0, 4*np.pi, N)

y = np.sin(x)

source = ColumnDataSource(data=dict(x=x, y=y))

N2=N*10

Set up plot

plot = figure(plot_height=400, plot_width=950, title=“Distance, anomaly plot”,

tools=“tap,hover,crosshair,pan,reset,save,wheel_zoom,box_zoom,box_select,reset”,

x_range=[0, 4*np.pi], y_range=[-2.5, 2.5])

#plot.line(‘x’, ‘y’, source=source, line_width=3, line_alpha=0.6)

#plot.circle(‘x’, ‘y’, source=source, line_width=3, line_alpha=0.6)

plot.line(x, y, line_width=2)

plot.circle(x, y, fill_color=“white”, size=8)

show(plot, notebook_handle=True)

Many thanks!

Roi

On Friday, June 9, 2017 at 4:20:37 PM UTC+3, Bryan Van de ven wrote:

Hi,

More information/context is needed. In python in a Bokeh App? In a CustomJS callback in a standalone document? Please describe what you are trying to accomplish more fully.

Thanks,

Bryan

On Jun 8, 2017, at 00:45, rgr…@bgu.ac.il wrote:

Hi All,

I would like to be able to select a point on the plot, and be able to save that selection into a new variable (essentially, be able to save the selection of the hover tool, I think)

Any help would be much appreciated!

Thx

Roi

–
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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/1a5067f0-4e35-4273-981f-df9340c3d4ed%40continuum.io.

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

⌁   Link to post

End of archived discussion · Replies are disabled