Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the interactive_xy_plot interface, and make it work with specified y-scale #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions biocircuits/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ def interactive_xy_plot(base_plot, callback, slider_params, toggle_params,
A function that is executed to update the `ColumnDataSource` of
the interactive plot whenever a slider or toggle are updated.
It must have a call signature
`callback(source, x_range, sliders, toggles, *extra_args)`.
Here, `source` is a `ColumnDataSource`, and `x_range` is the
x_range of the plot. `sliders`, `toggles`, and `extra_args` are
`callback(source, x_range, y_range, sliders, toggles, *extra_args)`.
Here, `source` is a `ColumnDataSource`, `x_range` is the
x_range of the plot, and `y_range` is the y_range of the plot.
`sliders`, `toggles`, and `extra_args` are
as defined above.
slider_params : tuple of objects
Each object in the tuple is an instance of a class that has the
Expand Down Expand Up @@ -109,6 +110,9 @@ def _callback_toggle(new):
p.y_range.on_change('start', _callback)
p.y_range.on_change('end', _callback)

# Call the callback once, to kick things off
callback(source, p.x_range, p.y_range, sliders, toggles, *extra_args)

# Add the plot to the app
widgets = bokeh.layouts.widgetbox(*sliders, *toggles)
doc.add_root(bokeh.layouts.column(widgets, p))
Expand Down