#範例4-8:同時畫出三條圖(四位學生,三科成績) import plotly.express as px import plotly.graph_objs as go #第一條線:國文 fig=px.line(x=['tom','john','peter','jolin'], y=[75,55,65,99],title='chinese') #設定紅色線 fig.update_traces(line_color='red') #第二條線:英文 fig2 = px.line(x=['tom','john','peter','jolin'], y=[85,90,55,65],title='enlish') #設定紅色線 fig2.update_traces(line_color='green') fig.add_trace(fig2.data[0]) #第三條線:數學 fig3 = px.line(x=['tom','john','peter','jolin'], y=[95,90,60,90],title='mah') fig3.update_traces(line_color='blue') fig.add_trace(fig3.data[0]) fig.write_html('exp4-8.html',auto_open=True)