I’ve noticed that if I execute a Bokeh script multiple times inside a Jupyter session or even in a plain Python interactive session, the output HTML file size increases in each execution.
from bokeh.plotting import figure
from bokeh.io import output_file, show, save
That will create a 7 KB file first, and then every time I execute the cell, it adds 6 more KB to the file. I looked at the HTML file source code and it seems the input data are being appended to the JSON string multiple times. Same behavior if I execute those lines one by one in a simple Python shell more than once.
I also noticed that using save() instead of show() doesn’t increase the size of the produced file. So, the key seems to be the show() method.
Is this expected behavior? Anyone could explain the rationale behind this?