To save on processing time, I am trying to “cache” Figure objects by calling my_figure = figure(…), adding my glyphs with my_figure.add_glyph(…), and then storing my_figure in a cache:
my_cache = {‘saved_plot_1’: my_figure}
``
When I need to pull it out of the cache for plotting, I do so by making a deep copy of it:
self.my_gridplot.children = [copy.deepcopy(my_cache[‘saved_plot_1’])]
``
This works well on the first plotting, but subsequent plots produce plots of different sizes from the original. I suspect this is because the act of calling figure(…) or add_glyph(…) is causing some wanted side effect that no longer happens on subsequent pulls from the cache.
How do I reuse a deep copy of an object returned by figure(…) to create a plot guaranteed to be formatted (same size, spacing, all of the same attributes) the same each time?
Thank you,
Jeff

