Skip to content
Snippets Groups Projects
Verified Commit 79c03b22 authored by David Beniamine's avatar David Beniamine
Browse files

Bokeh example

parent 114fa04f
Branches
No related tags found
No related merge requests found
%% Cell type:code id: tags:
``` python
# From https://docs.bokeh.org/en/latest/docs/user_guide/interaction/widgets.html#colorpicker
from bokeh.io import show, output_notebook
from bokeh.layouts import column
from bokeh.models import ColorPicker
from bokeh.plotting import Figure
output_notebook()
plot = Figure(x_range=(0, 1), y_range=(0, 1), plot_width=350, plot_height=350)
line = plot.line(x=(0,1), y=(0,1), color="black", line_width=4)
picker = ColorPicker(title="Line Color")
picker.js_link('color', line.glyph, 'line_color')
show(column(plot, picker))
```
%% Output
%% Cell type:code id: tags:
``` python
from bokeh.models import TextInput
def my_text_input_handler(attr, old, new):
print("Previous label: " + old)
print("Updated label: " + new)
text_input = TextInput(value="default", title="Label:")
text_input.on_change("value", my_text_input_handler)
show(text_input)
```
%% Output
WARNING:bokeh.embed.util:
You are generating standalone HTML/JS output, but trying to use real Python
callbacks (i.e. with on_change or on_event). This combination cannot work.
Only JavaScript callbacks may be used with standalone output. For more
information on JavaScript callbacks with Bokeh, see:
https://docs.bokeh.org/en/latest/docs/user_guide/interaction/callbacks.html
Alternatively, to use real Python callbacks, a Bokeh server application may
be used. For more information on building and running Bokeh applications, see:
https://docs.bokeh.org/en/latest/docs/user_guide/server.html
%% Cell type:code id: tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment