plotly / plotly/plotly.py

Scattermapbox maki symbols plot on map, but not legend

Ouverte
#2,965 2 commentaires 12 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

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

Description

Hi Plotly,

First, thank you for all the fantastic work you do.

I am a big fan of / heavy user of the plotly.go objects that render maps (Scattermapbox / Choroplethmapbox).

I have noticed, however, that when setting the symbol type to a maki symbol, it will render it on the map - but not the legend. This feels like a bug, as there is also a colour associated with the legend item that is not matched anywhere on the plot / by the symbol (except in hovertext).

Reproducible example below:

import os
import plotly.graph_objects as go

mapboxt = os.getenv('MAPBOX_TOKEN') # a mapbox token

lats = [52.370216, 53.2191696,  50.851368, 51.8125626]
lons = [4.895168,  6.5666699, 5.690973, 5.8372264 ]

fig = go.Figure()

scatt = go.Scattermapbox(
            lat=lats,
            lon=lons,
            mode='markers',
            hovertext=['Amsterdam', 'Groningen',  'Maastricht', 'Nijmegen'],  
            hoverinfo='text',                 
            below='',                 
            marker=dict(symbol ='hospital'),
            name ='my_fake_hospitals',
            showlegend=True)

fig.add_trace(scatt)

fig.update_layout(go.Layout(title_text ='Is it a hospital? No, it is a blue dot!', 
                            title_x=0.5, 
                            width=750, 
                            height=700,
                            mapbox = dict(center= dict(lat=52.370216, lon=4.895168),            
                                         accesstoken= mapboxt,
                                         zoom=5,
                                         style="light"
                                       )))

fig

Finally, as a side note, some maki symbols plot whilst others do not. I have determined through trial and error that this is down to whether or not the MapBox style includes these specific symbol types. Using custom Mapbox styles, therefore, may silently break the maki functionality as well.

Thanks you for your attention.

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.

Piste de recherche

Commencez par exécuter l’exemple Python reproductible fourni avec Scattermapbox, le symbole Maki "hospital" et showlegend=True, puis comparez le symbole de la carte avec son élément de légende. Suivez la gestion de marker-symbol et de la légende de Scattermapbox, y compris la remarque concernant les styles Mapbox ; le travail est terminé lorsque les symboles Maki pris en charge apparaissent de manière cohérente dans la légende et sur la carte, avec un test de régression couvrant ce comportement.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
data-visualization
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
55/100

Recevez les nouvelles issues par e-mail

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