บทนำ
Bokeh: แพ็กเกจ Visualization โค้ดเปิด ใช้ HTML/JavaScript เหมาะกับ Web Dashboard ใช้กับ NumPy, Pandas ได้ สร้างกราฟโต้ตอบได้
Dependencies & Installation
Numpy, Pillow, Jinja2, Packaging, Pyyaml, Six, Tornado, Python-dateutil pip3 install bokeh conda install bokeh
Step Line Plot
ใช้ฟังก์ชัน step ใน glyph functions สำหรับข้อมูลแบบ discrete
ตัวอย่าง
from bokeh.plotting import figure, output_file, show
output_file("stepLine.html")
p = figure(plot_width=500, plot_height=300)
p.step([2, 5, 3, 6, 7, 9], [6, 3, 2, 1, 0, 5], line_width=2, mode="center")
show(p)
ผลลัพธ์

คำอธิบาย
- นำเข้าแพ็กเกจและตั้งชื่อย่อ
- สร้าง Figure กำหนดขนาด
output_fileกำหนดไฟล์ HTML output- ใช้
stepวาด Step line กำหนด mode="center" showแสดงผล