plotly / plotly/plotly.R

Range breaks in plotly R

Aperta
#1,789 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

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

Hi,

Recently Plotly introduced breaks on date axes ( plotly v 4.6.0 ). They are pretty handy to remove weekends and missing dates while plotting. So far the fix was to make the Date as type =Category. But this makes the range slider not working. Thats also why this rangebreak was brought up. I dont know if its available in R yet.

A small workable script is given below

library(readr)
library(plotly)

a <- read_csv("https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv")

plot_ly(a[450:500,], x = ~Date, y = ~AAPL.High, type='scatter', mode = 'markers') %>%
  layout(xaxis =  list(
    rangebreaks= list (
      values= c("2016-12-25", "2016-12-24","2016-12-26","2017-01-01"))
  ))

Screenshot of the output:

Screenshot 2020-06-10 at 12 10 56

This doesnt hide the missing dates, but it doesnt give any error either. I was wondering what am I doing wrong here.

Thanks

Additional information:
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] plotly_4.9.2.1 ggplot2_3.3.0 readr_1.3.1

loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 rtsdata_0.1.2 pillar_1.4.4 compiler_4.0.0 xts_0.12-0 tools_4.0.0 digest_0.6.25 jsonlite_1.6.1
[9] lifecycle_0.2.0 tibble_3.0.1 gtable_0.3.0 lattice_0.20-41 viridisLite_0.3.0 pkgconfig_2.0.3 rlang_0.4.6 cli_2.0.2
[17] rstudioapi_0.11 crosstalk_1.1.0.1 yaml_2.2.1 curl_4.3 withr_2.2.0 dplyr_0.8.5 httr_1.4.1 vctrs_0.3.1
[25] htmlwidgets_1.5.1 hms_0.5.3 grid_4.0.0 tidyselect_1.1.0 glue_1.4.1 data.table_1.12.8 R6_2.4.1 fansi_0.4.1
[33] purrr_0.3.4 tidyr_1.1.0 magrittr_1.5 scales_1.1.1 ellipsis_0.3.1 htmltools_0.4.0 assertthat_0.2.1 colorspace_1.4-1
[41] lazyeval_0.2.2 munsell_0.5.0 crayon_1.3.4 zoo_1.8-8

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia eseguendo l'esempio fornito di plot_ly() con layout(xaxis = list(rangebreaks = ...)) in plotly 4.9.2.1 e confronta il risultato con il comportamento di Plotly per i rangebreak degli assi temporali. Traccia la gestione R-to-Plotly di xaxis rangebreaks e stabilisci se il risultato atteso consiste nel nascondere le date mancanti mantenendo al contempo un range slider funzionante.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, r
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.