In [11]:
import webbrowser
import pandas as pd

from bokeh.document import Document
from bokeh.models import Rect, Plot, DataRange1d, ColumnDataSource
from bokeh.session import Session

document = Document()
session = Session()
session.use_doc('graph_summary')
session.load_document(document)

df = pd.DataFrame(columns=["x", "y", "foo"])
df = df.append(pd.DataFrame(dict(x=[1], y=[1])))
df = df.append(pd.DataFrame(dict(x=[2], y=[2])))

ds = ColumnDataSource(df)

xdr = DataRange1d()
ydr = DataRange1d()

plot = Plot(x_range=xdr, y_range=ydr, title="Test", tools=[])

rect = Rect(x="y", y="y", width=0.2, height=0.2)
plot.add_glyph(ds, rect)

document.add(plot)
session.store_document(document)

link = session.object_link(plot)
webbrowser.open(link)


Using saved session configuration for http://localhost:5006/
To override, pass 'load_from_config=False' to Session
Out[11]:
True

In [ ]: