📅  最后修改于: 2020-11-09 05:10:41             🧑  作者: Mango
面积图是两个序列之间具有相同索引的填充区域。散景的Figure类具有以下两种方法-
varea()方法的输出是一个垂直定向区域,该区域具有一个x坐标数组和两个y坐标数组y1和y2,将在它们之间填充。
1 | x | The x-coordinates for the points of the area. |
2 | y1 | The y-coordinates for the points of one side of the area. |
3 | y2 | The y-coordinates for the points of the other side of the area. |
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()方法需要x1,x2和y参数。
1 | x1 | The x-coordinates for the points of one side of the area. |
2 | x2 | The x-coordinates for the points of the other side of the area. |
3 | y | The y-coordinates for the points of the area. |
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)