Я строю мультилинии по методу multi_line
.
from bokeh.plotting import figure, show
from bokeh.models import ColumnDataSource
source = ColumnDataSource(data=dict(
x=[3, 3],
y=[4, 4],
xs1=[[1, 2, 3], [2, 3, 4]],
ys1=[[6, 7, 2], [4, 5, 7]],
xs2=[[8, 9], [10, 11, 12]],
ys2=[[6, 7], [7, 8, 9]],
color=['red', 'green'],
width=[5, 1],
dash=['solid', 'dashed']
)
)
p = figure(
plot_width=400,
plot_height=400,
tools='lasso_select,pan,wheel_zoom'
)
p.multi_line(
xs='xs1',
ys='ys1',
source=source,
color='color',
line_join='round',
line_width='width', # this is working with the column name, despite the documentatio say nothing
# line_dash='dash' # this is not working
)
show(p)
. На исходных компакт-дисках мультилинии можно задать столбец для color
, alpha
или line_width
, чтобы построить каждую линию.по-другому.Но это не может быть применено к атрибуту line_dash
.Я хотел бы сделать основную строку solid
, а остальные dashed
.
Если я использую глиф line
для этих основных строк, то я потеряю производительность, потому что мне нужно обновить более одного глифав то же время на каждом графике.
С другой стороны, я думаю, что что-то упущено в документации о line_width
, поскольку столбцу CDS можно присвоить этот аргумент метода, и этоработает:
alpha (float) – an alias to set all alpha keyword args at once
color (Color) – an alias to set all color keyword args at once
>> line_width (float) - should this be added because it works with CDS columns?
Есть ли способ назначить столбец для атрибута line_dash
?
Я не проверял остальные атрибуты по глубине.