I’m plotting a Bar chart and I want to add error bars. I have used this: http://stackoverflow.com/questions/29166353/how-do-you-add-error-bars-to-bokeh-plots-in-python
but for some reason, despite adding the code below, I’m still not getting the error bars to show up. The Bar chart shows up as expected. Please advise. I’m not including my DataFrame to preserve confidentiality but I could perhaps erase some of the entries if that would make things easier.
p = Bar(all_contracts, values=’%_saved’, label=‘contract_type’, plot_width=450, plot_height=450,
ylabel = ‘Percentage saved’, xlabel = ‘Contract type’, tools=False, outline_line_alpha=0, line_color=‘white’,
notebook=True, color=‘grey’, fill_alpha=0.3)
p.legend.location = None
p.xgrid.grid_line_color = None
p.ygrid.grid_line_color = None
p.xaxis.major_tick_in = 0
p.xaxis.major_tick_out = 0
p.axis.minor_tick_in = 0
p.axis.minor_tick_out = 0
ys = all_contracts[’%_saved’]
xs = all_contracts[‘contract_type’]
create the coordinates for the errorbars
err_xs =
err_ys =
for x, y, yerr in zip(xs, ys, yerrs): # Also took out yerr from this line but that didn’t help much.
err_xs.append((x, x))
err_ys.append((all_contracts[‘lower_ci’], all_contracts[‘upper_ci’]))
plot them
p.multi_line(err_xs, err_ys, color=‘red’)
show(p)