I have a Juypter Notebook cell with some code (not mine) that generates a Bokeh plot. Last command in the cell is a Bokeh show() command. What I want is for the plot to appear in the output cell below, and then to be able to continue running subsequent cells in the notebook.
What happens instead is that when I run the cell the plot appears below, but the cell with the code continues to run (asterisk in the left-hand brackets) and never stops. So I can't continue to run any other cells unless I click the stop button (which leaves the plot intact in the output cell, but follows it with many lines of error trace-back messages).
My understanding is that executing the output_notebook() function should result in show() giving the behavior I want, as described here:
https://docs.bokeh.org/en/latest/docs/user_guide/notebook.html
In their screenshot, the cell with the show() command has clearly finished running (no asterisk).
I'm not sure if it makes any difference, but in my case I am running the notebook on a remote server and using port-forwarding to view it on my laptop computer browser.
Does anyone know how I can get the show() command to finish running?
For reference, this is the code:
# Use the PCA projection
dset = proj_pca
# Select the dimensions in the projection
dim1 = 0
dim2 = 1
p = figure(plot_width=945, plot_height=560)
p.title.text = 'PCA projection: PC' + str(dim1+1) + ' vs PC' + str(dim2+1)
for cont in continents:
for pop in pop_by_continent[cont]:
projections_within_population = dset[indices_of_population_members[pop]]
p.circle(projections_within_population[:,dim1], projections_within_population[:,dim2],
legend=name_by_code[pop], color = color_dict[pop])
#p.legend.visible = False
p.legend.location = "top_center"
p.legend.click_policy="hide"
output_file("interactive_pca.html", title="PCA projection")
output_notebook()
#save(p)
show(p)