当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。