python - Ever-growing Bokeh's embed source files -


bokeh's embed source file keeps getting larger every time make 1 (from jupyter notebook). how can stop this?

code:

from bokeh.plotting import figure, show bokeh.embed import components bokeh.io import output_notebook output_notebook()  def my_plot(color):     p = figure(plot_width=400, plot_height=400)     p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], color=color)      script, div = components(p)     open('{}.html'.format(color),'w') f:         f.write(script)         f.write(div)      show(p)       my_plot('red') my_plot('blue') my_plot('green') my_plot('cyan') my_plot('magenta') my_plot('yellow') 

results:

 directory of c:\users\tomv\codes\misc  06/06/2016  15:43    <dir>          .. 06/06/2016  15:27    <dir>          .ipynb_checkpoints 06/06/2016  15:43    <dir>          . 06/06/2016  15:39            17,684 red.html 06/06/2016  15:40            23,366 blue.html 06/06/2016  15:40            29,049 green.html 06/06/2016  15:41            34,731 cyan.html 06/06/2016  15:41            40,416 magenta.html 06/06/2016  15:41            46,100 yellow.html 06/06/2016  15:43           246,485 bokeh_embed_test.ipynb                7 file(s)        437,831 bytes 

do not read further. added appease so's mindless robot wants me add detail.

as of version 0.11.1 need explicitly call reset_output in instances:

from bokeh.io import reset_output  reset_output() 

i suggest calling @ top of my_plot function.