I wanted to understand why calling figure() from bokeh.plotting (version 0.11.0) keeps the state of the object as I go on creating new figures. To provide some context, I am generating a lot of plots and then using autoload_static to generate the js file for each plot and embedding them to a custom designed html template. When I was using older versions of bokeh, I did not see any large increase in the size of the js (was around few 10KB). But after I got the version 0.11.0 the js sizes were large (few MBs). After debugging through the code, I found out that figure preserves the previous instances and keeps appending to it. So I tried using Figure the actual constructor and problem was resolved.
I was wondering if this is a bug or if it is meant to serve a purpose, as the documentation points out to use figure (or was the documentation not updated).
disclaimer: not a professional developer, just a data scientist trying out bokeh.