DataLab Docs
  • What is DataLab?
  • Work
    • Creating a workbook
    • Sharing a workbook
    • Managing a workbook
    • Code cell
      • Working with packages
    • Text cell
      • Including images
    • SQL cell
      • SQL scenarios
      • Parameterize your SQL query
    • Explore Data cell
    • Chart cell
      • Configuring your chart
      • Pivot charts
      • Migration guide
    • AI Assistant
    • Version history
    • Scheduled runs
    • Hiding and showing cells
    • Long-running cells
    • Report view
    • Environment variables
    • Git and GitHub
  • Connect to Data
    • Connect your data to DataLab
    • Sharing a Data Source
    • Airtable
    • Amazon Athena
    • Amazon S3
    • Databricks
    • Dropbox
    • Files
    • Google Drive
    • Google BigQuery
    • Google Sheets
    • MariaDB
    • Microsoft SQL Server
    • MongoDB
    • MotherDuck
    • MySQL
    • Oracle Database
    • PostgreSQL
    • Redshift
    • Snowflake
    • Supabase
  • Guides
    • Publish a notebook
    • Importing data from flat files
    • Resizing plots
    • Show Bokeh and Pyvis plots
  • Resources
    • Pricing
    • Manage group settings
    • Reporting for Group Admins
    • DataLab for education
    • Technical requirements
    • Addressing slow code
    • Address R vulnerability
    • Get help
Powered by GitBook
On this page

Was this helpful?

  1. Guides

Show Bokeh and Pyvis plots

PreviousResizing plotsNextPricing

Last updated 1 year ago

Was this helpful?

DataLab supports most visualisation libraries available for Python and R like and . Some visualisation libraries require special attention to correctly generate output in DataLab.

Python

Bokeh ()

DataLab does not natively support outputs from Bokeh. The guide outlined in the for Jupyter notebooks is not supported. In DataLab it is required to generate a HTML output. You can use the following helper function to display a Bokeh graph:

from IPython.display import HTML
from bokeh.embed import file_html
from bokeh.resources import CDN

def display_bokeh(bokeh_figure):
    return HTML(file_html(bokeh_figure, CDN))

Pyvis ()

Pyvis writes outputs to HTML files. The following example contains a helper function display_pyvis which takes a pyvis graph and a name as arguments and will return the HTML output of the graph.

# IMPORTS
from IPython.display import HTML
from pyvis import network as net
import networkx as nx

def display_pyvis(pyvis_graph, name):
    filename = f"{name}.html"
    pyvis_graph.save_graph(filename)
    return HTML(filename=filename)    


g = net.Network(notebook=True, cdn_resources='in_line')
nxg = nx.complete_graph(5)
g.from_nx(nxg)

display_pyvis(g, "pyvis-example")
matplotlib
plotly
docs
Bokeh docs
docs