![]() ![]() When I have static_path refer to my remote computer's python install (as shown above, commented out), I can't see the plot in the html page when I access it through the web (ie, going to ). However, what I really want to do is have this run on a remote computer, and have the html file accessible through the web on my personal site. embed.js) to my local computer, I can see the plot in the html file. If I have the python code reference my local python installation and copy the generated files (.html and. This produces a file that looks like (random garbage).embed.js, and a prints string containing html syntax that I manually copy into an html file I am calling testembed.html, which I have reproduced below: # static_path='/opt/anaconda/lib/python2.7/site-packages/bokeh/server/static/') #the following line refers to the bokeh installed on my remote computer Static_path='/usr/local/lib/python2.7/site-packages/bokeh/server/static/') #the following line refers to the bokeh installed on my home computer Basically, I am generating a plot using bokeh as follows: import otting as bplt For that, see Embedding Bokeh Server as Library.I am trying to statically embed a bokeh plot in a personal website, and am encountering some behavior I do not understand. The very rough outline of such apps is: from bokeh.io import curdocĪlternatively it's also possible to embed Bokeh server apps in "regular" python scripts. ![]() If you simply want a Bokeh sever app (which requires running on a Bokeh server, because that is the Python process that runs your callbacks) that can run outside the notebook, the easiest way is to put all the code in a script that you run with bokeh serve -show myapp.py When you embed a bokeh server app in the notebook, as you have done above, that process is the IPython kernel. Real Python code callbacks require a live, running Python interpreter process. It is not possible for a standalone HTML document to run real Python code, because browsers have no ability whatsoever to run Python code. You have created a Bokeh server application, with real Python code callbacks. What you are asking for is not possible, at least not as I understand your question. Hope anybody is able to help me out with this. RuntimeError: no display hook installed for notebook type None If I change the output_notebook() to output_file('tryout.html'), it givesme the following error, which I dont understand and could find a solution for as well: N_select = Slider(start = 2, end = 20, step = 1, value = 2, title = 'number of points',width=700)Ĭontrols = WidgetBox(N_select,data_table) New_src, new_src2 = make_dataset(N_select.value) Return ColumnDataSource(data),ColumnDataSource(dataMean) # Now the same plot, but fitted with a slider widget P.circle(source=src1,y='y',x='x',color='green')ĬolumnsT = [TableColumn(field="mean", title="mean"),ĭata_table = DataTable(source=src2, columns=columnsT, width=400, height=400) Title = 'Test case',x_axis_label = 'x', y_axis_label = 'y') P = figure(plot_width = 700, plot_height = 400, import numpy as npįrom bokeh.io import save, curdoc,output_file ,show, output_notebook, push_notebookįrom otting import figure, gridplotįrom bokeh.models import ColumnDataSource, Panelįrom import Slider, Tabs, DataTable, TableColumnįrom bokeh.layouts import layout, WidgetBoxįrom import FunctionHandlerįrom bokeh.application import Applicationĭata = pd.DataFrame(np.random.random(),columns=)ĭataMean = pd.DataFrame(,columns=) How do I get the interactive plots with widgets working in a standalone HTML?īelow you can find a working example in Jupyter Notebook with Bokeh 13.0 installed. ![]() When using the Jupyter NB "download to" HTML function located in the toolbar, everything but the interactive Bokeh plots export well, also the static Bokeh plots (static plots are 'interactive' as well, but the underlying data does not change) ![]() I'm looking for a way to export my Jupyter Notebook containing interactive Bokeh plots with widgets to standalone HTML. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |