Python 的 Plotly 資料視覺化入門
Alex Scriven
Data Scientist
$$

$$
add_annotation()$$
update_layout() 與 annotations 參數text - 要顯示的文字內容$$
x 與 y:指定註解位置$$
showarrow = True/False - 是否顯示箭頭$$
🛑 絕對定位註解要小心——資料變動時可能重疊
x 與 y 指的是圖中的資料值$$
xref 與 yref 設為 paper 可進行絕對定位x 與 y 是圖區的 0 到 1 百分比x=0.5、y=0.5)會在圖表正中央
my_annotation = dict( x=215111, y=449000,showarrow=True, arrowhead=3,text="Our company is doing well", font=dict(size=10, color="black") )fig.update_layout(annotations=[my_annotation]) fig.show()
$$

$$
float_annotation = dict( xref="paper", yref="paper",x=0.5, y=0.8,showarrow=False, text="You should <b>BUY</b>", font=dict(size=15, color="black"), bgcolor="rgb(255,0,0)" )

Python 的 Plotly 資料視覺化入門