plotly / plotly/plotly.R

ggplotly does not respect the `width` of tiles, fills the "no data" range instead

Abierto
#1,957 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

ggplotly does not respect the width value used for tiles. In the examples, the tiles should have a constant width, but converting the visualisation with ggplotly() results in a different visualisation, in which the areas with no data associated are "filled in" by the bordering tiles. It looks like the tiles expand on both sides equally, just enough to fill the empty space.

Note that what is meant by "no data" here is different to "missing data": the x value has no corresponding row in the dataset.

library(ggplot2)
library(plotly)
# default tile width
(default_width <- ggplot(mapping = aes(x = c(1, 2, 4), y = 1, fill = 1:3)) +
   geom_tile())

Convert to plotly:

ggplotly(default_width)

default

If one provides a custom width for the tiles, ggplotly() still ignores it:

# custom tile width
(custom_width <- ggplot(mapping = aes(x = c(1, 2, 4), y = 1, fill = 1:3)) +
    geom_tile(width = .5))

Convert to plotly:

ggplotly(custom_width)

custom

This does not happen if doing something similar with geom_col().

Using:

  • R 4.1.0
  • ggplot2 3.3.3
  • plotly 4.9.3

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

Reproduce el problema con los ejemplos de R usando ggplotly() y geom_tile(), comparando los casos de ancho predeterminado y personalizado con el comportamiento de geom_col(). Rastrea la conversión de los anchos de los mosaicos por parte de ggplotly() y verifica que los huecos correspondientes a valores de x sin filas permanezcan vacíos y que se respete geom_tile(width = .5).

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.