MRocklin
MRocklin

Reputation: 57271

Bokeh line plots with variable width lines

Can I use Bokeh to construct plot a line with error measurements as extended areas?

I'm looking to construct something like the following:enter image description here

Upvotes: 1

Views: 3313

Answers (1)

Luke Canavan
Luke Canavan

Reputation: 2137

You could try using a Patch glyph in addition to your line, such as:

from bokeh.plotting import figure, output_file, show

output_file("patch.html")

p = figure(plot_width=400, plot_height=400)

p.patch([1,2,3,4,5,5,4,3,2,1], 
        [1.8, 2.8, 1.5, 2.5, 1.5, 2.5, 3.2, 2.2, 3.4, 2.3], 
        alpha=0.5, line_width=2)
p.line([1,2,3,4,5],[2,3,2,3,2], line_color='black', line_width=4)

show(p)

enter image description here

Upvotes: 4

Related Questions