當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python Streamlit st.bokeh_chart用法及代碼示例

顯示交互式散景圖。

Bokeh 是 Python 的圖表庫。此函數的參數緊跟 Bokeh 的 show 函數的參數。您可以在 https://bokeh.pydata.org 找到更多關於散景的信息。

函數簽名

st.bokeh_chart(figure, use_container_width=False)
參數說明

figure (bokeh.plotting.figure.Figure)

要繪製的散景圖。

use_container_width (bool)

如果為 True,則將圖表寬度設置為列寬。這優先於 Bokeh 的原生 width 值。

To show Bokeh charts in Streamlit, call `st.bokeh_chart` (null)

沒有說明

wherever you would call Bokeh's `show`. (null)

沒有說明

示例

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)

相關用法


注:本文由純淨天空篩選整理自streamlit.io大神的英文原創作品 st.bokeh_chart。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。