範例4-2:使用Dictionary字典數據來畫圖(使用low-level plotly方法) #注意1:這個方法,必須在jupyter網頁來寫程式,無法在spiter編輯器 #設定fig = Dictionary字典數據 #缺點:這個low-level 方法的數據較原始,不易使用 #結構: """ fig = dict({"data":[{"type":"bar","x":串列list,"y":串列list}] import ploty.io as pio pio.show(fig) """ #完整程式碼: #格式:fig = dict({"data":[{"type":"bar","x":串列list,"y":串列list}] fig = dict({ "data": [{"type": "bar", "x": [1, 2, 3], "y": [1, 3, 2]}], "layout": {"title": {"text": "A Figure Specified By Python Dictionary"}} }) #使用low-level plotly.io來顯示fig字典數據的圖形 import plotly.io as pio pio.show(fig)