บทนำ
Bokeh รองรับ Vertical Bar Chart ผ่านเมธอด vbar ระบุ bottom, top, width, color ได้อย่างยืดหยุ่น
การติดตั้ง
pip3 install bokeh conda install bokeh
Dependencies
Numpy, Pillow, Jinja2, Packaging, Pyyaml, Six, Tornado, Python-dateutil
ตัวอย่างโค้ด
from bokeh.plotting import figure, output_file, show
fig = figure(plot_width=400, plot_height=400)
fig.vbar(x=[2, 5, 9, 3], width=0.5, bottom=0, top=[2, 4, 6, 8], color="Cyan")
output_file('barplot.html')
show(fig)คำอธิบาย
ใช้
vbarระบุ x, top (ความสูง), bottom (ฐาน), width, colorเหมาะสำหรับกราฟแท่งตั้งตรงทั่วไป