I have a Bokeh plot in a Jupyter notebook that can be zoomed and panned. In a later notebook cell I would like to call Bokeh's export_png function to export the plot exactly as it is displayed, however, the exported plot doesn't reflect the current zoom status of the plot.
E.g
from bokeh.plotting import figure, show
# prepare some data
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
# create a new plot with a title and axis labels
p = figure(title="Simple line example", x_axis_label="x", y_axis_label="y")
# add a line renderer with legend and line thickness
p.line(x, y, legend_label="Temp.", line_width=2)
# show the results
show(p)
And then in later cell:
from bokeh.io import export_png
export_png(p, filename="plot_test.png")
I could click the "save" button in the plot toolbar, this saves the plot exactly as it is displayed in the notebook with the current zoom state, however I'm curious if it would be possible to do this programmatically in the notebook?