Deprecation notice
st.bokeh_chart was deprecated in version 1.49.0. Use the streamlit-bokeh custom component instead.
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.
Important
You must install bokeh==2.4.3 and numpy<2 to use this command, which is deprecated and will be removed in a future version.
For more current updates, use the streamlit-bokeh custom component instead.
| Function signature[source] | |
|---|---|
st.bokeh_chart(figure, use_container_width=True) | |
| Parameters | |
figure (bokeh.plotting.figure.Figure) | A Bokeh figure to plot. |
use_container_width (bool) | Whether to override the figure's native width with the width of the parent container. If use_container_width is True (default), Streamlit sets the width of the figure to match the width of the parent container. If use_container_width is False, Streamlit sets the width of the chart to fit its contents according to the plotting library, up to the width of the parent container. |
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)
Still have questions?
Our forums are full of helpful information and Streamlit experts.