所以我创建了一个包含一些线和一个跨度(或多个跨度)的图形。
f = figure()
f.line(x, y1, legend_label='1st set')
f.line(x, y2, legend_label='2st set')
vl = Span(location=x_point,
dimension='height',
line_dash='dotdash', line_color="black", line_alpha=0.7)
f.add_layout(vl)
我想在该图的默认图例中添加跨度条目。
答案 0 :(得分:2)
默认的Legend
仅适用于字形渲染器,因此您无法直接将Span
添加到图例。
但是您可以创建一个不带数据且具有与跨度相同参数的字形:
f.line([], [], legend_label='span'
line_dash='dotdash', line_color="black", line_alpha=0.7)