as a very simple example when I want to export a visualisation to a html in bokeh i'd do something like this:
#importing bokeh
from bokeh.plotting import figure
from bokeh.io import output_file, show
#data prep
x=[1,2,3,4,5]
y=[6,7,8,9,10]
#prep output file
output_file('line.html')
#create a figure object
f=figure()
#create a line plot
f.square(x,y)
show(f)
which seems to work fine.
however when working with a visualisation like a histogram and when working with pandas_bokeh i cant get it to export as a html. for example:
import pandas as pd
import pandas_bokeh
pandas_bokeh.output_notebook()
df['any random numerical column'].plot_bokeh(kind='hist',)
output_file('hist.html')
anyone know how i can get this to work?
my second question is, is how would I export a viz if I was using holoviews? as in how can the code be altered here: http://holoviews.org/gallery/demos/bokeh/boxplot_chart.html for it to be done?
any light shed on these 2 questions would be greatly appreciated and please explain as simply as possible as this is all fairly new to me. thank you
To quote form the documentation for
output_file()
:Another option is to call
save()
afteroutput_file()
to create the HTML-File.Example for pandas-bokeh
Since
show()
is called insidepandas-bokeh
anyway an even shorter example to generate the same figure is:Holoviews
For holoviews there exists the method `hv.save() to genreate a html, too.
But you can also get the bokeh object by calling
p = hv.render(fig)
and do the same with thesave
from thepandas-bokeh
example.I didn't try it, but it is also possible that holoviews internally calls
show()
so the second example cloud also work.