I am not really a biologist or use bokeh. But looking at their
documentation it looked pretty simple. So I decided to try it. Here's a
simple example.
This is your controller function
def index():
from bokeh.plotting import figure
from bokeh.embed import components
# prepare some data
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
# create a new plot with a title and axis labels
p = figure(title="simple line example", x_axis_label='x', y_axis_label=
'y')
# add a line renderer with legend and line thickness
p.line(x, y, legend="Temp.", line_width=2)
script, div = components(p)
return {'bokeh_script': script, 'bokeh_div': div}
This is the index.html view you would use to show the graph made in the
controller
{{extend 'layout.html'}}
{{block head}}
<link href="http://cdn.pydata.org/bokeh/release/bokeh-0.12.10.min.css" rel=
"stylesheet" type="text/css">
<link href=
"http://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.10.min.css" rel=
"stylesheet" type="text/css">
<script src="http://cdn.pydata.org/bokeh/release/bokeh-0.12.10.min.js"></
script>
<script src=
"http://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.10.min.js"></script>
{{response.write(bokeh_script, escape=False)}}
{{end}}
{{response.write(bokeh_div, escape=False)}}
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.