plotly / plotly/plotly.py

Dedicated docs on running a dash application using plotly scattergeo graphs when not connected to the internet

未关闭
#3,974 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@LiamConnors 已经在做这个了。

开始于 2024年7月5日。

documentation feature P3
主要语言
Python
星标
18.8k
派生
2.8k
平均合并
16 小时 26 分钟
30 天内合并 PR
21

描述

I helped a Dash OSS user solve an issue today that took much longer than it should have. The developer was building a dash application that uses plotly.graph_objects.Scattergeo. The application worked well, but when the user ran the application locally without being connected to the internet, the chart would not render. The user works in a secure government setting and is likely one of many who have run into similar issues. I believe it would be useful to have a section in the plotly.py scattergeo section that shows how to run the charts fully offline.

The specific issue we ran into was caused because Plotly charting is looking for assets like https://cdn.plot.ly/usa_110m.json to render with. This location is unreachable if the app is offline.

These two community posts address and solve the issue but are out dated.
https://community.plotly.com/t/loading-geo-assets-offline-solved/11869
https://community.plotly.com/t/offline-scattergeo-plots-not-working/43790

The issue is common enough that it deserves to have better SEO and be more searchable.

All that was required to solve it in the Dash application offline was setting the plotlyConfig to point towards the asset directory in the app and referencing the plotlyConfig in the config prop within the dcc.Graph(). It was also necessary to upload the two relevant .json files to my assets folder. 1 , 2

plotlyConfig = {'topojsonURL':'http://127.0.0.1:8050/assets/'} 
...
dcc.Graph(id="example-graph", figure=fig, config=plotlyConfig),

@LiamConnors love to get your thoughts on this.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。