How do I plot a step function with Bokeh?

bokeh, python

Solution

Bokeh has a `Step` glyph built-in as of version `0.12.11`:

from bokeh.plotting import figure, output_file, show

output_file("line.html")

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

# add a steps renderer
p.step([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2, mode="center")

show(p)

Problem

In matplotlib to make a step function you write something like this: ``` import matplotlib.pyplot as plt x = [1,2,3,4] y = [0.002871972681775004, 0.00514787917410944, 0.00863476098280219, 0.012003316194034325] plt.step(x, y) plt.show() ``` How do I make a similar graph with Bokeh?

Original source

Related problems