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)
输出
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)
输出

