Kyso
Kyso.ioAbout Us
  • What is Kyso?
  • Getting started
    • Architecture and Deployment
  • Kyso's Renderer
    • Jupyter Notebooks
    • Jupyter FAQ
      • Kyso's Jupyter Renderer
      • Bokeh Plots and Kyso
    • HTML
    • Markdown
    • PDFs
    • PowerPoints
    • RTF Documents
    • Embedded Dashboards
      • Google Sheets
      • Looker Dashboards
      • Tableau Dashboards
      • Microsoft BI Dashboards
      • Plotly's Dash
      • Streamlit
    • Videos
  • Publishing Workflows
    • Creating Reports In-App
    • Kyso's Command Line Tool
      • Installation
        • Using Amazon Linux
      • Authorization
      • Publishing & Downloading
      • Advanced configuration
    • Integrating with Git
      • Github
      • Gitlab
      • Bitbucket
    • Configuring Report Metadata
    • Importing Files from S3
    • Publishing FAQ
      • Meta Reports
      • Pushing Single Files
      • Issues with Report Rendering
  • Search and Discovery
    • Searching Reports
    • Browsing Files & Versions
  • COLLABORATION
    • Report Comments
    • Report Tasks
    • Notebook Report Snippets
    • Business Notifications
      • Slack
      • Microsoft Teams
  • Settings & Administration
    • Themes & Styling
    • Permissions System
    • Managing Access
    • SSO Configuration
  • Resources
    • How to manage adoption
      • Driving Internal Engagement
      • Advice for Large Companies
    • R Users & R Markdown
    • Writing a good data-science report
Powered by GitBook
On this page

Was this helpful?

  1. Kyso's Renderer
  2. Jupyter FAQ

Bokeh Plots and Kyso

Use this snippet to make bokeh plots work seamlessly in Jupyter and Kyso.

PreviousKyso's Jupyter RendererNextHTML

Last updated 1 year ago

Was this helpful?

To make bokeh plots work inside Jupyter and render on Kyso, we need to save the plot to a virtual html file and then show it in the notebook:

from bokeh.plotting import figure, output_file, save
from IPython.display import IFrame
from IPython.core.display import display, HTML
import tempfile

def bokeh_show(plot):
    tmp_output_filename = tempfile.NamedTemporaryFile(suffix='.html').name
    output_file(tmp_output_filename)
    save(plot)

    f = open(tmp_output_filename, "r")
    display(HTML(f.read()))

Then we can use this function bokeh_show to show any plots we create:

p = figure(title="Bokeh test", plot_width=300, plot_height=300)
p.circle([1, 2], [3, 4])

bokeh_show(p)

[1]

[2]

https://deepnote.com/@jz/Bokeh-in-Deepnote-V6xAdXsXSTKYrEE84782qg
https://stackoverflow.com/questions/31562898/bokeh-save-plot-as-html-but-dont-show-it/45598392#45598392