scattermapbox non-circle marker symbols not shown in legend since v4.12.0
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Since upgrading to plotly 4.12.0, only the "circle" symbol is rendered correctly in the legend for scattermapbox traces. Other marker symbols (e.g. "diamond", "square") are no longer displayed — the legend shows a blank entry for those.
v 4.12.0
v 4.11.0
(note that already in previuos versions, the non-circle markers were not shown on the canvas itself, but this was not an issue in our use case, because we only wanted to create the custom legend with the square markers)
reprex
library(plotly)
symbols_to_try <- c(
"circle",
"diamond",
"square",
"marker"
)
traces <- lapply(seq_along(symbols_to_try), function(i) {
list(
type = "scattermapbox",
mode = "markers",
lon = i * 2,
lat = 51,
name = symbols_to_try[i],
showlegend = TRUE,
hoverinfo = "name",
marker = list(
color = "steelblue",
size = 20,
symbol = symbols_to_try[i]
)
)
})
p <- plotly_empty() |>
layout(
mapbox = list(
style = "carto-positron",
center = list(lon = 5, lat = 51),
zoom = 3
),
legend = list(x = 1, xanchor = "right", y = 1)
) |>
config(displaylogo = FALSE)
for (tr in traces) {
p <- add_trace(p,
inherit = FALSE,
type = tr$type,
mode = tr$mode,
lon = tr$lon,
lat = tr$lat,
name = tr$name,
showlegend = tr$showlegend,
hoverinfo = tr$hoverinfo,
marker = tr$marker
)
}
p
packageVersion("plotly")
Further info:
The legend (and markers on canvas) work fine with "scattergeo" or even "scatter", but it has other side-effects in our setting that makes the plot be drawn twice, even if setting the layout like
plotly::layout(
plotly_object,
geo = list(
visible = FALSE,
showframe = FALSE,
showcoastlines = FALSE,
showland = FALSE,
showocean = FALSE
)
)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit dem bereitgestellten R-reprex unter Verwendung von scattermapbox-Traces und vergleichen Sie das Legendenverhalten zwischen plotly 4.11.0 und 4.12.0. Verfolgen Sie, wie Markersymbole durch add_trace übergeben werden, und untersuchen Sie die scattermapbox-Legendenbehandlung; abgeschlossen ist die Aufgabe, wenn Einträge für circle, diamond, square und marker korrekt gerendert werden, ohne das Verhalten von scattergeo oder scatter zu beeinflussen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, r
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 38/100