I am trying to plot a simple chart with Bokeh but it fails to display anything when the x values are text based:
x=['-', 'AF', 'AS', 'EU', 'NA', 'OC', 'SA']
y=[8, 7621750, 33785311, 31486697, 38006434, 7312002, 7284879]
p = figure(plot_width=480, plot_height=300,title='test')
p.vbar(x=x, width=0.5, bottom=0, top=y, color="navy", alpha=0.5)
p.toolbar.logo = None
p.toolbar_location = None
v = gridplot([[p]])
show(v)
I am wondering if this is a bug. Version: 0.13.0
After applying the suggested fix it works:
for i in range(4):
ind=i+offset
rez[ind].sort(key=lambda tup: tup[0])
x = [x[0] for x in rez[ind]]
y = [x[1] for x in rez[ind]]
if type(x[0]) == str:
charts[i] = figure(
plot_width=480,
plot_height=300,
title=columns_being_investigated[ind],
x_range=x)
else:
charts[i] = figure(
plot_width=480,
plot_height=300,
title=columns_being_investigated[ind])
charts[i].vbar(x=x, width=0.5, bottom=0, top=y, color="navy", alpha=0.5)
charts[i].toolbar.logo = None
charts[i].toolbar_location = None
p = gridplot([[charts[0], charts[1]], [charts[2], charts[3]]])
show(p)

