I was trying this with bokeh 0.12.5 using the example from “bokeh/examples/plotting/file/legend.py” with no success.
from bokeh.document import Document
from bokeh.plotting import show, output_file, figure
from bokeh.layouts import gridplot
import numpy as np
x = np.linspace(0, 4*np.pi, 100)
y = np.sin(x)
TOOLS = “pan,wheel_zoom,box_zoom,reset,save,box_select”
p1 = figure(title=“Legend Example”, tools=TOOLS)
p1.circle(x, y, legend=“sin(x)”)
p1.circle(x, 2y, legend="2sin(x)", color=“orange”)
p1.circle(x, 3y, legend="3sin(x)", color=“green”)
p2 = figure(title=“Another Legend Example”, tools=TOOLS)
p2.circle(x, y, legend=“sin(x)”)
p2.line(x, y, legend=“sin(x)”)
p2.line(x, 2y, legend="2sin(x)", line_dash=(4, 4), line_color=“orange”, line_width=2)
p2.square(x, 3y, legend="3sin(x)", fill_color=None, line_color=“green”)
p2.line(x, 3y, legend="3sin(x)", line_color=“green”)
output = gridplot(p1, p2, ncols=2, plot_width=400, plot_height=400)
doc = Document()
t = doc.to_json()
newdoc = Document()
I get an
AttributeError: ‘Document’ object has no attribute ‘references’
Would you be able to point me to an example of how to implement this functionality?
On Friday, June 16, 2017 at 12:55:54 PM UTC-4, Bryan Van de ven wrote:
Bokeh already has specialized serialization requirements, in order to communicate between Python Bokeh and BokehJS. I would encourage you to use the existing JSON representation that Bokeh itself generates, and not try to use pickle. I have very little confidence that pickle would currently work, or that it could easily be made to work.
The Documents class has methods to generate and load JSON:
You should be able to use these to save or replace curdoc()
On Jun 16, 2017, at 11:45, RiskiBizniz [email protected] wrote:
Does anyone have any experience with pickling bokeh plot objects, saving them to a file or database , retrieving them and perhaps using them again to update the data sources or integrate the object with a bokeh server?
I would be grateful for some advice or resources on how to perform these actions.
I generate a lot of plot objects from reports and would like to save them when working with my web application. Any ideas?
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/374561d1-74f1-4759-a46b-5de61c1e272e%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.