TapTool in static plot

Hi.
I’ve a scatter plot. Each point has a text field. My data is like:

x,y,text

2,4,“Hello”

3,2,“Bokeh is great”

7,3,“Thanks for you help”

Can the text be shown in a separate text plot (next to the scatter plot) plot when I click the point in the scatter plot ?

Thanks !

ARthur

Yes!

Have a look at the example here: http://nbviewer.ipython.org/github/birdsarah/pycon_2015_bokeh_talk/blob/master/notebooks/Building%20the%20static%20visualization.ipynb

If you scroll all the way to the bottom you will see that when you click a country, the text in the right box changes.

Hopefully you can get what you need from the code there.

Sincerely,

Sarah Bird

···

On Tue, May 12, 2015 at 1:32 PM, Arthur Dijkstra [email protected] wrote:

Hi.
I’ve a scatter plot. Each point has a text field. My data is like:

x,y,text

2,4,“Hello”

3,2,“Bokeh is great”

7,3,“Thanks for you help”

Can the text be shown in a separate text plot (next to the scatter plot) plot when I click the point in the scatter plot ?

Thanks !

ARthur

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/1c9f1647-ae9f-40a9-8fd7-5ac47371c76b%40continuum.io.

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

Hi Sarah,
Thanks for the link. I can’t get a minimalist example working.

Can you (or anyone else) provide an example based on:

x,y,text

2,4,“Hello”

3,2,“Bokeh is great”

7,3,“Thanks for you help”

Thanks !

Arthur

···

Op donderdag 14 mei 2015 05:56:49 UTC+2 schreef Sarah Bird:

Yes!

Have a look at the example here: http://nbviewer.ipython.org/github/birdsarah/pycon_2015_bokeh_talk/blob/master/notebooks/Building%20the%20static%20visualization.ipynb

If you scroll all the way to the bottom you will see that when you click a country, the text in the right box changes.

Hopefully you can get what you need from the code there.

Sincerely,

Sarah Bird

On Tue, May 12, 2015 at 1:32 PM, Arthur Dijkstra [email protected] wrote:

Hi.
I’ve a scatter plot. Each point has a text field. My data is like:

x,y,text

2,4,“Hello”

3,2,“Bokeh is great”

7,3,“Thanks for you help”

Can the text be shown in a separate text plot (next to the scatter plot) plot when I click the point in the scatter plot ?

Thanks !

ARthur

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/1c9f1647-ae9f-40a9-8fd7-5ac47371c76b%40continuum.io.

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


For information, services and offers, please visit our web site: http://www.klm.com.

This e-mail and any attachment may contain confidential and privileged material intended for the addressee only.

If you are not the addressee, you are notified that no part of the e-mail or any attachment may be disclosed, copied or distributed,

and that any other action related to this e-mail or attachment is strictly prohibited, and may be unlawful.

If you have received this e-mail by error, please notify the sender immediately by return e-mail, and delete this message.

Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its employees shall not be liable for the incorrect or

incomplete transmission of this e-mail or any attachments, nor responsible for any delay in receipt.

Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch Airlines) is registered in Amstelveen, The Netherlands,

with registered number 33014286


Hi Sarah,
Thanks for the link. I can’t get a minimalist example to work.

Can you (or anyone else) build a minimalist example based on:

x,y,text

2,4,“Hello”

3,2,“Bokeh is great”

7,3,“Thanks for you help”

Thanks !

Arthur

···

Op donderdag 14 mei 2015 05:56:49 UTC+2 schreef Sarah Bird:

Yes!

Have a look at the example here: http://nbviewer.ipython.org/github/birdsarah/pycon_2015_bokeh_talk/blob/master/notebooks/Building%20the%20static%20visualization.ipynb

If you scroll all the way to the bottom you will see that when you click a country, the text in the right box changes.

Hopefully you can get what you need from the code there.

Sincerely,

Sarah Bird

On Tue, May 12, 2015 at 1:32 PM, Arthur Dijkstra [email protected] wrote:

Hi.
I’ve a scatter plot. Each point has a text field. My data is like:

x,y,text

2,4,“Hello”

3,2,“Bokeh is great”

7,3,“Thanks for you help”

Can the text be shown in a separate text plot (next to the scatter plot) plot when I click the point in the scatter plot ?

Thanks !

ARthur

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/1c9f1647-ae9f-40a9-8fd7-5ac47371c76b%40continuum.io.

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


For information, services and offers, please visit our web site: http://www.klm.com.

This e-mail and any attachment may contain confidential and privileged material intended for the addressee only.

If you are not the addressee, you are notified that no part of the e-mail or any attachment may be disclosed, copied or distributed,

and that any other action related to this e-mail or attachment is strictly prohibited, and may be unlawful.

If you have received this e-mail by error, please notify the sender immediately by return e-mail, and delete this message.

Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its employees shall not be liable for the incorrect or

incomplete transmission of this e-mail or any attachments, nor responsible for any delay in receipt.

Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch Airlines) is registered in Amstelveen, The Netherlands,

with registered number 33014286


Hi Arthur,

Here’s a code snippet inspired by Sarah’s notebook that should do what you were asking for:

from bokeh.plotting import *

from collections import OrderedDict

from bokeh.models import HoverTool, Range1d

from bokeh.models import Text

source = ColumnDataSource(

data=dict(

x = [2, 3, 7],

y = [4, 2, 3],

text = [“Hello”, “Bokeh is great”,“Thanks for you help”]

)

)

output_file(“scatter.html”, title=“scatter.py example”)

p = figure(tools=“pan,wheel_zoom,box_zoom,reset,save,hover,crosshair,box_select”)

p.scatter(‘x’,‘y’, color=“red”, source=source)

hover =p.select(dict(type=HoverTool))

hover.tooltips = OrderedDict([

(“(x,y)”, “($x, $y)”),

(“text”, “@text”),

(“x”, “@x”),

(“y”, “@y”)

])

def construct_text_box(source):

Plot and axes

xdr = Range1d(0, 220)

ydr = Range1d(0, 120)

plot = Plot(x_range=xdr, y_range=ydr, title=“”, plot_width=250,

plot_height=120, min_border=0)

txt1 = Text(x=0, y=0, text=‘text’, text_color=“white”)

txt2 = Text(x=10, y=10, text=‘text’, text_font_size=‘18pt’,

text_color=“#2B292E”)

plot.add_glyph(source, txt1, selection_glyph=txt2)

return plot

txtbox = construct_text_box(source)

show(hplot(p, txtbox))

``

Cheers

Fabio

···

On Saturday, May 16, 2015 at 1:49:06 AM UTC+2, [email protected] wrote:

Hi Sarah,
Thanks for the link. I can’t get a minimalist example to work.

Can you (or anyone else) build a minimalist example based on:

x,y,text

2,4,“Hello”

3,2,“Bokeh is great”

7,3,“Thanks for you help”

Thanks !

Arthur

Op donderdag 14 mei 2015 05:56:49 UTC+2 schreef Sarah Bird:

Yes!

Have a look at the example here: http://nbviewer.ipython.org/github/birdsarah/pycon_2015_bokeh_talk/blob/master/notebooks/Building%20the%20static%20visualization.ipynb

If you scroll all the way to the bottom you will see that when you click a country, the text in the right box changes.

Hopefully you can get what you need from the code there.

Sincerely,

Sarah Bird

On Tue, May 12, 2015 at 1:32 PM, Arthur Dijkstra [email protected] wrote:

Hi.
I’ve a scatter plot. Each point has a text field. My data is like:

x,y,text

2,4,“Hello”

3,2,“Bokeh is great”

7,3,“Thanks for you help”

Can the text be shown in a separate text plot (next to the scatter plot) plot when I click the point in the scatter plot ?

Thanks !

ARthur

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/1c9f1647-ae9f-40a9-8fd7-5ac47371c76b%40continuum.io.

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


For information, services and offers, please visit our web site: http://www.klm.com.

This e-mail and any attachment may contain confidential and privileged material intended for the addressee only.

If you are not the addressee, you are notified that no part of the e-mail or any attachment may be disclosed, copied or distributed,

and that any other action related to this e-mail or attachment is strictly prohibited, and may be unlawful.

If you have received this e-mail by error, please notify the sender immediately by return e-mail, and delete this message.

Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its employees shall not be liable for the incorrect or

incomplete transmission of this e-mail or any attachments, nor responsible for any delay in receipt.

Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch Airlines) is registered in Amstelveen, The Netherlands,

with registered number 33014286


Wow you are really great !

Bokeh enables me to build stuff i could only dream about.

Thanks a lot.

Arthur

···

Verstuurd vanaf mijn iPad

Op 17 mei 2015 om 21:59 heeft Fabio Pliger [email protected] het volgende geschreven:

Hi Arthur,

Here’s a code snippet inspired by Sarah’s notebook that should do what you were asking for:

from bokeh.plotting import *

from collections import OrderedDict

from bokeh.models import HoverTool, Range1d

from bokeh.models import Text

source = ColumnDataSource(

data=dict(

x = [2, 3, 7],

y = [4, 2, 3],

text = [“Hello”, “Bokeh is great”,“Thanks for you help”]

)

)

output_file(“scatter.html”, title=“scatter.py example”)

p = figure(tools=“pan,wheel_zoom,box_zoom,reset,save,hover,crosshair,box_select”)

p.scatter(‘x’,‘y’, color=“red”, source=source)

hover =p.select(dict(type=HoverTool))

hover.tooltips = OrderedDict([

(“(x,y)”, “($x, $y)”),

(“text”, “@text”),

(“x”, “@x”),

(“y”, “@y”)

])

def construct_text_box(source):

Plot and axes

xdr = Range1d(0, 220)

ydr = Range1d(0, 120)

plot = Plot(x_range=xdr, y_range=ydr, title=“”, plot_width=250,

plot_height=120, min_border=0)

txt1 = Text(x=0, y=0, text=‘text’, text_color=“white”)

txt2 = Text(x=10, y=10, text=‘text’, text_font_size=‘18pt’,

text_color=“#2B292E”)

plot.add_glyph(source, txt1, selection_glyph=txt2)

return plot

txtbox = construct_text_box(source)

show(hplot(p, txtbox))

``

Cheers

Fabio

On Saturday, May 16, 2015 at 1:49:06 AM UTC+2, [email protected] wrote:

Hi Sarah,
Thanks for the link. I can’t get a minimalist example to work.

Can you (or anyone else) build a minimalist example based on:

x,y,text

2,4,“Hello”

3,2,“Bokeh is great”

7,3,“Thanks for you help”

Thanks !

Arthur

Op donderdag 14 mei 2015 05:56:49 UTC+2 schreef Sarah Bird:

Yes!

Have a look at the example here: http://nbviewer.ipython.org/github/birdsarah/pycon_2015_bokeh_talk/blob/master/notebooks/Building%20the%20static%20visualization.ipynb

If you scroll all the way to the bottom you will see that when you click a country, the text in the right box changes.

Hopefully you can get what you need from the code there.

Sincerely,

Sarah Bird

On Tue, May 12, 2015 at 1:32 PM, Arthur Dijkstra [email protected] wrote:

Hi.
I’ve a scatter plot. Each point has a text field. My data is like:

x,y,text

2,4,“Hello”

3,2,“Bokeh is great”

7,3,“Thanks for you help”

Can the text be shown in a separate text plot (next to the scatter plot) plot when I click the point in the scatter plot ?

Thanks !

ARthur

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/1c9f1647-ae9f-40a9-8fd7-5ac47371c76b%40continuum.io.

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


For information, services and offers, please visit our web site: http://www.klm.com.

This e-mail and any attachment may contain confidential and privileged material intended for the addressee only.

If you are not the addressee, you are notified that no part of the e-mail or any attachment may be disclosed, copied or distributed,

and that any other action related to this e-mail or attachment is strictly prohibited, and may be unlawful.

If you have received this e-mail by error, please notify the sender immediately by return e-mail, and delete this message.

Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its employees shall not be liable for the incorrect or

incomplete transmission of this e-mail or any attachments, nor responsible for any delay in receipt.

Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch Airlines) is registered in Amstelveen, The Netherlands,

with registered number 33014286


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/81a99c4e-31a4-4dd8-a9c9-95ba69d5ed6e%40continuum.io.

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