plotly

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Plotly

Plotly

Plotly creates interactive (zoomable, hoverable) charts in the browser. v6.0 (2025) drops big dependencies (Pandas is optional) and improves performance.
Plotly可在浏览器中创建交互式(可缩放、可悬停)图表。2025年发布的v6.0版本移除了大型依赖项(Pandas变为可选)并提升了性能。

When to Use

适用场景

  • Dashboards: Streamlit, Dash.
  • 3D Plots: Rotating 3D scatter plots.
  • Interactivity: Users need to drill down into data.
  • 仪表板:Streamlit、Dash。
  • 3D图表:可旋转的3D散点图。
  • 交互需求:用户需要深入挖掘数据的场景。

Core Concepts

核心概念

Plotly Express (
px
)

Plotly Express (
px
)

High-level API.
px.scatter(df, x="a", y="b", color="c")
.
高级API。示例代码:
px.scatter(df, x="a", y="b", color="c")

Graph Objects (
go
)

Graph Objects (
go
)

Low-level API.
go.Figure(data=[go.Scatter(...)])
.
低级API。示例代码:
go.Figure(data=[go.Scatter(...)])

Dash

Dash

The framework for building web apps with Plotly charts.
用于构建集成Plotly图表的Web应用框架。

Best Practices (2025)

2025年最佳实践

Do:
  • Use Plotly Express: It covers 90% of use cases.
  • Use WebGL:
    render_mode='webgl'
    for large datasets (>10k points).
Don't:
  • Don't use it for static papers: Use Matplotlib for print.
建议
  • 使用Plotly Express:它能覆盖90%的使用场景。
  • 使用WebGL:处理大型数据集(超过10000个数据点)时,使用
    render_mode='webgl'
不建议
  • 不要用于静态论文:打印场景请使用Matplotlib。

References

参考资料