Bokeh 简明教程

Bokeh - Setting Ranges

绘图中数据轴的数字范围由 Bokeh 根据处理中的数据集自动设置。但是,有时您可能希望明确定义 x 和 y 轴上的值范围。这是通过将 x_range 和 y_range 属性分配给 figure() 函数来完成的。

Numeric ranges of data axes of a plot are automatically set by Bokeh taking into consideration the dataset under process. However, sometimes you may want to define the range of values on x and y axis explicitly. This is done by assigning x_range and y_range properties to a figure() function.

使用 range1d() 函数定义这些范围。

These ranges are defined with the help of range1d() function.

Example

xrange = range1d(0,10)

若要将此范围对象用作 x_range 属性,请使用以下代码 -

To use this range object as x_range property, use the below code −

fig = figure(x,y,x_range = xrange)