plotly / plotly/plotly.py

Scattermapbox maki symbols plot on map, but not legend

Aperta
#2,965 2 commenti 12 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug P3
Lingua principale
Python
Stelle
18.8k
Fork
2.8k
Merge medio
16h 26m
PR unite (30g)
21

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia eseguendo l’esempio Python riproducibile fornito con Scattermapbox, il simbolo Maki "hospital" e showlegend=True, quindi confronta il simbolo della mappa con il relativo elemento della legenda. Analizza la gestione di marker-symbol e della legenda di Scattermapbox, inclusa la nota sugli stili Mapbox; il lavoro è completo quando i simboli Maki supportati compaiono in modo coerente nella legenda e nella mappa, con il comportamento coperto da un test di regressione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.