ggplotly barcharts with Dates and dynamicTicks=T
Nessuno ha ancora preso questa issue.
- Lingua principale
- R
- Stelle
- 2.7k
- Fork
- 641
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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")

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")

Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia eseguendo l'esempio R riproducibile dell'issue in plotly.R e confronta i casi di asse x Date e character con dynamicTicks e highlight abilitati. Il lavoro è completato quando la barra del 4 luglio viene renderizzata con il colore previsto e facendo clic su di essa highlight viene applicato correttamente, mantenendo etichette delle date utilizzabili.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- r
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100