# [Python] Bokeh 資料視覺化 ###### tags: `Python` --- **先 import** `from bokeh.plotting import figure, show` **第一次使用先pip套件** `pip3 install bokeh` **Scatter plot** 定義繪圖板寬高: `p = figure(plot_width=500, plot_height=500)` **定義資料:** ``` x = [1,2,3,4,5,6,7,8,9,10,11] y = [6,3,7,2,4,6,1,2,3,5,6] ``` **將資料放到圖上並顯示:** ``` p.circle(x, y, size=20, color="gray", alpha=0.6) show(p) ``` **結果圖:** ![](https://i.imgur.com/YayAUUL.jpg) **Multiple Lines** **定義資料:** ``` x1 = [1,2,3] x2 = [2,3,4,5,6] y1 = [5,2,3] y2 = [2,3,4,1,4] ``` **使用multi_line():** ``` p.multi_line([x1,x2] , [y1, y2], color=["firebrick", "navy"], alpha=[0.9, 0.1], line_width=2) show(p) ``` **結果圖:** ![](https://i.imgur.com/hRymztl.jpg)