plotly / plotly/plotly.py

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

Ouverte
#3,974 0 commentaires 0 réactions 1 personne assignée Voir sur GitHub

@LiamConnors y travaille déjà.

Depuis le 5/7/2024.

documentation feature P3
Langage dominant
Python
Étoiles
18.8k
Forks
2.8k
Merge moyen
16 h 26 min
PR mergées (30 j)
21

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.