plotly / plotly/plotly.R

scattermapbox non-circle marker symbols not shown in legend since v4.12.0

Abierto
#2,481 1 comentario 0 reacciones 0 asignados Ver en GitHub

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

Image

v 4.11.0

Image

(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

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. 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

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.