Bokeh how to add legend to figure created by multi_line method? -


i'm trying add legend figure, contains 2 lines created multi_line method. example:

p = figure(plot_width=300, plot_height=300) p.multi_line(xs=[[4, 2, 5], [1, 3, 4]], ys=[[6, 5, 2], [6, 5, 7]], color=['blue','yellow'], legend="first") 

in case legend first line. when legend defined list there error:

p.multi_line(xs=[[4, 2, 5], [1, 3, 4]], ys=[[6, 5, 2], [6, 5, 7]], color=['blue','yellow'], legend=["first","second"]) 

is possible add legend many lines?

multi_line intended conceptually single things, happen have multiple sub-components. think of state of texas, 1 logical thing, has several distinct (and disjoint) polygons. might use patches draw polys "texas" you'd want 1 legend overall. legends label logical things. if want label several lines logically distinct things, have draw them separately p.line(..., legend="...")


Comments