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 件 担当者 1 名 GitHub で見る

@LiamConnors がすでに取り組んでいます。

2024年7月5日 から。

documentation feature P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。