scattermapbox non-circle marker symbols not shown in legend since v4.12.0
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- R
- Estrellas
- 2.7k
- Forks
- 641
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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
)
)
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comience con el reprex de R proporcionado usando traces de scattermapbox y compare el comportamiento de la leyenda entre plotly 4.11.0 y 4.12.0. Trace cómo se pasan los símbolos de marcador mediante add_trace e inspeccione el manejo de la leyenda de scattermapbox; se considera terminado cuando las entradas circle, diamond, square y marker se renderizan correctamente sin afectar al comportamiento de scattergeo o scatter.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, r
- Área
- data-visualization
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100