Bokeh 区域图


面积图是两个系列之间的填充区域,它们共享一个共同的索引。 Bokeh的Figure类有两个方法如下:

varea()


varea() 方法的输出是一个垂直方向区域,它有一个 x 坐标数组和两个 y 坐标数组 y1 和 y2,它们之间将被填充。

1 x 区域点的 x 坐标。
2 y1 区域一侧的点的 y 坐标。
3 y2 区域另一侧的点的 y 坐标。

例子

from bokeh.plotting import figure, output_file, show
fig = figure()
x = [1, 2, 3, 4, 5]
y1 = [2, 6, 4, 3, 5]
y2 = [1, 4, 2, 2, 3]
fig.varea(x = x,y1 = y1,y2 = y2)
output_file('area.html')
show(fig)
varea

harea()


另一方面, harea() 方法需要 x1、x2 和 y 参数。

1 x1 区域一侧的点的 x 坐标。
2 x2 该区域另一侧的点的 x 坐标。
3 y 区域点的 y 坐标。

例子

from bokeh.plotting import figure, output_file, show
fig = figure()
y = [1, 2, 3, 4, 5]
x1 = [2, 6, 4, 3, 5]
x2 = [1, 4, 2, 2, 3]
fig.harea(x1 = x1,x2 = x2,y = y)
output_file('area.html')
show(fig)
harea