[บันทึกกันลืม] แก้ปัญหา Plotly ไม่แสดง Chart บน JuputerLab

ในการ Visualization บน Jupyter Notebook, Juputer Lab พื้นฐานก็จะใช้ matplotlib, seaborn และเพื่อให้ทำ Interactive ได้มากขึ้น ก็จะไปใช้ Plotly และ Dash

ปัญหาคือ ถ้าเริ่มต้นใช้งาน Juputer Notebook / Jupyter Lab แล้วติดตั้ง plotly, dash package แล้ว บน Jupyter ก็ไม่แสดงผลแบบ Inline แบบนี้

ค้นหาพักใหญ่ ก็พบว่า อ้อ ต้องติดตั้ง jupyter labextension ด้วย วิธีตรวจสอบว่า ตอนนี้มี Extension อะไรอยู่บ้าง ใช้คำสั่งต่อไปนี้

jupyter labextension list

ผลคือ โดยค่าเริ่มต้น ไม่มี jupyterlab-plotly กับ plotlywidget ติดตั้งอยู่

วิธีการติดตั้ง ใช้คำสั่งต่อไปนี้

! jupyter labextension install jupyterlab-plotly plotlywidget
! jupyter lab build

แล้ว restart kernel

จากนั้น ลอง jupyter labextension list อีกครั้ง

แล้วก็จะสามารถใช้ Plotly ได้