การแสดงผลข้อมูลด้วย Plotly ใน Python
Alex Scriven
Data Scientist
$$

$$
add_annotation()$$
update_layout() และอาร์กิวเมนต์ annotationstext - ข้อความที่จะแสดงผล$$
x และ y: ระบุตำแหน่งของ annotation$$
showarrow = True/False - ใช้แสดงหรือซ่อนลูกศร$$
🛑 ระวังการวาง annotation แบบ absolute — หากข้อมูลเปลี่ยน อาจทับซ้อนกันได้
x และ y อ้างอิงถึงค่าข้อมูลในกราฟ$$
xref และ yref เป็น paper เพื่อวาง annotation แบบ absolutex และ 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)" )

การแสดงผลข้อมูลด้วย Plotly ใน Python