How to source.push_notebook() using the new bokeh.io.push_notebook API?

source.push_notebook() used to work before 0.11.0. Now it is replaced with bokeh.io.push_notebook, but there are zero examples on how to update a particular plot:

Bokeh Docs :

push_notebook(document=None, state=None, handle=None)
Update the last-shown plot in a Jupyter notebook with the new data or property values.

Parameters:

  • document (Document, optional) – A Document to push from. If None, uses curdoc().
  • state (State, optional) – A Bokeh State object
    Returns:
    None

Examples

Typical usage is typically similar to this:

from bokeh.io import push_notebook

# code to create a plot

show(plot)

plot.title = "New Title"

# This will cause the title to update
push_notebook()

What’s a document? What’s a handle?

If I pass the result of figure() or p.circle() to either handle or document I get errors, i.e. these are not the objects expected by bokeh.io.push_notebook.

I’m happy to PR to update the documentation, but need to figure out what a document is and what a handle is.

Ok, will have to answer my own question:

handle = show(plot)

push_notebook(handle=handle)

That works. Multiple plots in a notebook update on arrival of an event affecting a particular plot. Sweet.

···

On Monday, August 22, 2016 at 9:57:31 AM UTC+1, [email protected] wrote:

source.push_notebook() used to work before 0.11.0. Now it is replaced with bokeh.io.push_notebook, but there are zero examples on how to update a particular plot:

http://bokeh.pydata.org/en/0.11.1/docs/reference/io.html#bokeh.io.push_notebook :

push_notebook(document=None, state=None, handle=None)
Update the last-shown plot in a Jupyter notebook with the new data or property values.

Parameters:

  • document (Document, optional) – A Document to push from. If None, uses curdoc().
  • state (State, optional) – A Bokeh State object
    Returns:
    None

Examples

Typical usage is typically similar to this:

from [bokeh.io](http://bokeh.io) import push_notebook

# code to create a plot

show(plot)

plot.title = "New Title"

# This will cause the title to update
push_notebook()

What’s a document? What’s a handle?

If I pass the result of figure() or p.circle() to either handle or document I get errors, i.e. these are not the objects expected by bokeh.io.push_notebook.

I’m happy to PR to update the documentation, but need to figure out what a document is and what a handle is.

There are also example notebooks that demonstrate all of this in examples/howto/notebook_comms

If you'd care to submit a PR to enhance the documentation it would certainly be appreaciated.

Thanks,

Bryan

···

On Aug 22, 2016, at 5:02 AM, [email protected] wrote:

Ok, will have to answer my own question:

handle = show(plot)
push_notebook(handle=handle)

That works. Multiple plots in a notebook update on arrival of an event affecting a particular plot. Sweet.

On Monday, August 22, 2016 at 9:57:31 AM UTC+1, rootsum...@gmail.com wrote:
source.push_notebook() used to work before 0.11.0. Now it is replaced with bokeh.io.push_notebook, but there are zero examples on how to update a particular plot:

http://bokeh.pydata.org/en/0.11.1/docs/reference/io.html#bokeh.io.push_notebook :

push_notebook(document=None, state=None, handle=None)¶
Update the last-shown plot in a Jupyter notebook with the new data or property values.

Parameters:
  • document (Document, optional) – A Document to push from. If None, uses curdoc().
  • state (State, optional) – A Bokeh State object
Returns:
None

Examples

Typical usage is typically similar to this:

from bokeh.io import push_notebook

# code to create a plot

show(plot)

plot.title = "New Title"

# This will cause the title to update
push_notebook()

What's a document? What's a handle?

If I pass the result of figure() or p.circle() to either handle or document I get errors, i.e. these are not the objects expected by bokeh.io.push_notebook.

I'm happy to PR to update the documentation, but need to figure out what a document is and what a handle is.

--
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/11ae3476-dded-4e28-be27-4bd0ccd91e48%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.