☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Importing "figure" leads to larger plot objects

Community Support
datamonger
datamonger

Hello,
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).

Thank you

disclaimer: not a professional developer, just a data scientist trying out bokeh.

⌁   Link to post
Bryan
Bryan

Hi,

This is both a documentation issue as well a something we hope to be able to do better about in the near future, see this issue for a more detailed discussion and steps to mitigate:

Bryan

···

On Feb 8, 2016, at 7:28 PM, datamonger <superishav@gmail.com> wrote:

Hello,
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).

Thank you

disclaimer: not a professional developer, just a data scientist trying out bokeh.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/15afd52c-1a3b-41f3-9774-f1022c681206%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post

End of archived discussion · Replies are disabled