when trying to enter two datasource this error popped up. RuntimeError: Models must be owned by only a single document, StringFormatter(id='1266', ...) is already in a doc
df_2 = pd.DataFrame({
'Fields': x ,
'C_Info': values
})
src_1 = ColumnDataSource(df_2)
cols = [
TableColumn(field='Fields', title='Portfolio'),
TableColumn(field='C_Info', title='CapInfo')
]
myTable = DataTable(source=src_1, columns=cols)
src_3 = ColumnDataSource(df2)
cols_1 = [
TableColumn(field='variable', title='Earnings Component'),
TableColumn(field='values', title='Amount'),
TableColumn(field='PercentageTotalEarning', title='Percentage Total Earning'),
]
myTable2 = DataTable(source=src_3, columns=cols_1)
show(column(myTable,myTable2))
This error occurs when using
bokeh.plotting.save
andbokeh.plotting.show
in the same cell of a python notebook.Solution
Now create your figure as usual, calling
bokeh.plotting.figure()
:Now save your figure but don't show it using bokeh:
Now show your figure using
IFrame
:Please note, width and height in
IFrame
should be set slightly larger than your figure dimension that you have set inplot_width
andplot_height
Now you have both the saving and the displaying in the same cell.