How to add horizontal line (`Span`) to the Box plot in Bokeh?
<p>What I want is to render a <a href="http://bokeh.pydata.org/en/latest/docs/user_guide/charts.html#bar-charts" rel="nofollow">bar chart</a> with a <a href="http://stackoverflow.com/questions/28797330/infinite-horizontal-line-in-bokeh">horizontal line</a>, so I can see which values (represented by bars) exceed certain treshold (horisontal line). My data is represented by Pandas dataframe.</p>

<pre><code>from bokeh.plotting import figure, output_file, show
from bokeh.charts import Bar
from bokeh.models import Span
from bokeh.io import save
from pandas import DataFrame

output_file('tmp_file')

p = figure(plot_width=800, plot_height=600)

rows = [(1,'2004-01-15', 10), (2,'2004-02-21', 15)]
headers = ['id', 'date', 'value']

df = DataFrame.from_records(rows, columns=headers)
bar = Bar(df, 'date', values='value', agg='mean')

treshold = 12

hline = Span(location=treshold, dimension='width', line_color='red', line_width=3)

p.renderers.extend([hline, bar])
save(p)
</code></pre>

<p>The Exeption I get:</p>

<pre><code>File "/usr/lib/python3.4/site-packages/bokeh/core/properties.py", line 1056, in validate
    raise ValueError("expected an element of %s, got seq with invalid items %r" % (self, invalid))
ValueError: expected an element of List(Instance(Renderer)), got seq with invalid items [&lt;bokeh.charts.chart.Chart object at 0x7fa0a4534f28&gt;]
</code></pre>

<p>Ok, I figured it out...</p>

<pre><code>from bokeh.charts import Bar
from bokeh.models import Span
from bokeh.io import save, output_file, show
from pandas import DataFrame
output_file('tmp_file')

rows = [(1,'2004-01-15', 10), (2,'2004-02-21', 15)]
headers = ['id', 'date', 'value']

df = DataFrame.from_records(rows, columns=headers)
bar = Bar(df, 'date', values='value', agg='mean')

treshold = 12

hline = Span(location=treshold, dimension='width', line_color='red', line_width=3)

bar.renderers.extend([hline])
save(bar)
</code></pre>

python pandas dataframe data-visualization bokeh