Goal is to save svg-figure with bokeh in google colab.
I followend the docs at https://colab.research.google.com/github/bebi103a/bebi103a.github.io/blob/master/lessons/06/intro_to_plotting_with_bokeh.ipynb
Result: RuntimeError, s. details below
p = bokeh.plotting.figure(
width=400,
height=300,
x_axis_label="confidence when correct",
y_axis_label="confidence when incorrect",
)
p.circle(
source=df,
x="confidence when correct",
y="confidence when incorrect"
)
p.output_backend = "svg"
bokeh.io.export_svgs(p, filename="insomniac_confidence_correct.svg")
Then there is an error:
RuntimeError: To use bokeh.io image export functions you need selenium ('conda install selenium' or 'pip install selenium')
Example code exporting to SVG using Bokeh from Colab:
Bokeh expects a web browser to be available to create its figures. This can be a little tricky with how the virtual machine that runs the Colab instance is set up. You can manually install the correct browser packages on the virtual machine instance. Or, you can use something like the
google-colab-seleniumpackage to do the installation work for you. In the above code,google-colab-seleniumprovides its own installation of Chrome. Thebokehfunctions that expect a web browser let you pass which browser driver you want to use. So from there, you're just able to pass in the webdriver thatgoogle-colab-seleniumprovides.