Bokeh 图表#
条形图#
- bokeh.bar(y=None, data_points=None, add_interaction=True, aggregate_fn=None, step_size=None, step_size_type=<class 'int'>, title='', autoscaling=True, unselected_alpha=0.1, **library_specific_params)#
- 参数:
- x: str
GPU 数据框中的 x 轴列名
- y: str, default None
GPU 数据框中的 y 轴列名
- data_points: int, default None
当为 None 时,表示未提供自定义 bin 数量,data_points 将默认为 df[self.x].nunique()
- add_interaction: {True, False}, default True
- aggregate_fn: {‘count’, ‘mean’}, default ‘count’
- step_size: int, default None
- step_size_type: {int, float}, default int
- title: str,
图表标题
- autoscaling: bool,
设置当数据更新时,图表 y 轴的比例是否自动更新
- unselected_alpha: float, default 0.1
- **library_specific_params
要传递给函数的其他库特定的关键字参数,所有支持的参数列表可以通过运行以下代码找到:```python
>>> import holoviews as hv >>> hv.help(hv.Bars)
- 返回值:
- 类型为 vbar 的 bokeh 图表对象
示例#
import cudf
import cuxfilter
cux_df = cuxfilter.DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
bar_chart_1 = cuxfilter.charts.bar('key', 'val', data_points=5, add_interaction=False)
d = cux_df.dashboard([bar_chart_1])
#view the individual bar chart part of the dashboard d
bar_chart_1.view()