plotly / plotly/plotly.R

Range breaks in plotly R

未关闭
#1,789 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,在 plotly 4.9.2.1 下运行提供的、带有 layout(xaxis = list(rangebreaks = ...)) 的 plot_ly() 示例,并将结果与 Plotly 的日期轴 rangebreak 行为进行比较。追踪 R-to-Plotly 对 xaxis rangebreaks 的处理,并确定预期结果是否是在保留可正常工作的 range slider 的同时隐藏缺失的日期。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, r
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。