plotly / plotly/plotly.R

ggplotly barcharts with Dates and dynamicTicks=T

Abierto
#1,364 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug ggplotly
Lenguaje dominante
R
Estrellas
2.7k
Forks
641
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I experience a weird behaviour when using barcharts with Dates on the x-Axis and dynamicTicks=T.

1 bar of the example (4th July) is in a different color, it doesnt show up and the highlight function also doesnt color the clicked bar, although the legend suggests otherwise.

When converting the Dates to character, everything shows up correctly and also the highlight function shows up, but the labels look horrible.


Plot with Dates

library(ggplot2)
library(plotly)

dfN <- data.frame(
  time_stamp = seq.Date(as.Date("2018-04-01"), as.Date("2018-07-30"), 1),
  val = runif(121, 100,1000),
  col = "green", stringsAsFactors = F
)

dfN[95,]$col = "orange"

maxY = max(dfN$val)
key <- highlight_key(dfN)

p <- ggplot() +
  geom_col(data = key, aes(x = (time_stamp), y = val, fill=I(col)), width = 1)

## 4 of July doesnt show at all (should show an orange bar)
ggplotly(p, source = "Src", dynamicTicks = T, originalData = T) %>%
  highlight(selectize=F, on="plotly_click", off = "plotly_doubleclick", color = "blue")

rplot


Plot with Characters

p <- ggplot() +
  geom_col(data = key, aes(x = as.character(time_stamp), y = val, fill=I(col)), width = 1) +
  ggtitle("Characters on x-Axis")

ggplotly(p, source = "Src", dynamicTicks = T, originalData = T) %>%
  highlight(selectize=F, on="plotly_click", off = "plotly_doubleclick", color = "blue")

rplot02

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

Empieza ejecutando el ejemplo reproducible de R del issue en plotly.R y compara los casos de eje x Date y character con dynamicTicks y highlight habilitados. Se considera completado cuando la barra del 4 de julio se renderiza con el color esperado y al hacer clic en ella se aplica highlight correctamente, manteniendo etiquetas de fecha utilizables.

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
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.