plotly / plotly/plotly.R

`add_annotations` incompatible with multicategory axis

Abierto
#1,838 0 comentarios 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

I've been attempting to plot horizontal arrows using add_annotations in a plotly object with a multicategory y-axis. Instead of positioning annotations along the y-axis, they are all positioned at the origin.

(Because the same behavior occurs with other types of annotation, I have included some text in the reprex as well.)

library(tibble)
library(plotly)
#> Loading required package: ggplot2
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout

tribble(
  ~cat1, ~cat2, ~start, ~end,
  "a", "f", 1, 2,
  "a", "g", 2, 3,
  "a", "h", 3, 0,
  "b", "f", 0, 3
  ) %>% 
  plot_ly(y = ~list(cat1, cat2)) %>% 
  add_markers(x = ~start) %>% 
  add_markers(x = ~end) %>% 
  add_annotations(text = ":(",
                  showarrow = TRUE,
                  xref = "x", axref = "x",
                  yref = "y", ayref = "y",
                  x = ~start,
                  ax = ~end,
                  y = ~list(cat1, cat2),
                  ay = ~list(cat1, cat2))

plot

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

Comienza con el R reprex proporcionado y el punto de entrada add_annotations; después, sigue cómo se gestionan los valores de multicategory y-axis para annotations frente a markers. Reproduce el posicionamiento del origen con el ejemplo y verifica que las annotations que usan list(cat1, cat2) se posicionen a lo largo del multicategory axis sin provocar regresiones en otros annotation types.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
r
Área
data-visualization
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.