Display an interactive Bokeh chart.

Bokeh is a charting library for Python. The arguments to this function closely follow the ones for Bokeh's show function. You can find more about Bokeh at https://bokeh.pydata.org.

To show Bokeh charts in Streamlit, call st.bokeh_chart wherever you would call Bokeh's show.

Function signature

st.bokeh_chart(figure, use_container_width=False)

Parameters

figure (bokeh.plotting.figure.Figure)

A Bokeh figure to plot.

use_container_width (bool)

If True, set the chart width to the column width. This takes precedence over Bokeh's native width value.

Example

import streamlit as st
from bokeh.plotting import figure

x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]

p = figure(
     title='simple line example',
     x_axis_label='x',
     y_axis_label='y')

p.line(x, y, legend_label='Trend', line_width=2)

st.bokeh_chart(p, use_container_width=True)
(view standalone Streamlit app)

Was this page helpful?

editSuggest edits
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.