Bokeh Plot with a nominal or ordinal axis type

♀尐吖头ヾ 提交于 2019-12-06 10:16:13
Damian Avila

You need to pass the label as x_range=label and use p.xaxis.major_label_orientation to set up label orientation...

from bokeh.plotting import figure
from bokeh.io import output_file, show

output_file("bar.html")

label = ['United States', 'Russia', 'South Africa', 'Europe (average)', 'Canada', 'Austalia', 'Japan']
value = [700, 530, 400, 150, 125, 125, 75]

p = figure(x_range=label, y_range=(0, 800))
p.xaxis.major_label_orientation = np.pi/4   # radians, "horizontal", "vertical", "normal"

p.vbar(x=label, top=value , width=0.5, color = "#ff1200")

show(p)

Cheers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!