Infinite horizontal line in Bokeh

You are looking for “spans”:

Spans (line-type annotations) have a single dimension (width or height) and extend to the edge of the plot area.

Please, take a look at
http://docs.bokeh.org/en/latest/docs/user_guide/basic/annotations.html#spans

So, the code will look like:

import numpy as np
import bokeh.plotting as bk
from bokeh.models import Span

p = bk.figure()

# Vertical line
vline = Span(location=0, dimension='height', line_color="red", line_width=3)
# Horizontal line
hline = Span(location=0, dimension='width', line_color="green", line_width=3)

p.renderers.extend([vline, hline])
bk.show(p)

With this solution users are allowed to pan and zoom at will. The end of the lines will never show up.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)