plotly / plotly/plotly.R

Tooltip of ggplotly's geom_area not updating along the x axis

Abierto
#2,270 2 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

Recently, the hover text/tooltip when using geom_area() only shows the values for the first element along the x axis - in the example below, the geom_col graph has the expected tooltips, but the geom_area is stuck with the first value.

library(tidyverse)
economics %>% {ggplot(., aes(x=date,y=pop)) + geom_area()} %>% plotly::ggplotly()
economics %>% {ggplot(., aes(x=date,y=pop)) + geom_col()} %>% plotly::ggplotly()

The problem seems to be in ggplotly() as the native plot_ly() approach still works as expected:

plotly::plot_ly(x=~economics$date, y=~economics$pop, type='scatter', mode='none', stackgroup='one')

In a more complicated graph (with fill groups and facets) other elements seem to update, but the x and y values are stick at the first element still - again, compare geom_area to geom_col results:

economics_status <- economics %>% mutate(pop = pop - unemploy) %>% pivot_longer(cols = c(pop,unemploy), names_to="status", values_to="number")

economics_status %>% 
    {ggplot(., aes(x=date,y=number, fill=status)) + geom_area()} %>% plotly::ggplotly()

economics_status %>% 
    {ggplot(., aes(x=date,y=number, fill=status)) + geom_col()} %>% plotly::ggplotly()

I'm getting the error using R 4.2.2, plotly version 4.10.1. Rolling back using devtools, I am getting the same error back to plotly 4.9.4 - but anything earlier won't load any output at all, so presumably clashing with something else in the ecosystem. It may be relevant that htmlwidgets is at 1.6.2 and htmltools is 0.5.5.

However, all worked fine with R 4.1.3 and plotly 4.10.0 ... which had htmlwidgets at 1.5.4 and htmltools at 0.5.3. But rolling back htmlwidgets with the other settings above does not fix things.

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 reproduciendo los ejemplos de economía mediante ggplotly(), comparando geom_area() con geom_col() y con el enfoque nativo de plot_ly(). Rastrea la conversión de geom_area() y el manejo de los datos de los tooltips; el trabajo estará terminado cuando los valores x e y se actualicen a lo largo del eje para gráficos de áreas simples, rellenos y facetados.

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
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.