plotly / plotly/plotly.R

Range breaks in plotly R

Đang mở
#1,789 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
R
Star
2.7k
Fork
641
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách chạy ví dụ plot_ly() được cung cấp với layout(xaxis = list(rangebreaks = ...)) trên plotly 4.9.2.1 và so sánh kết quả với hành vi rangebreak trên trục ngày của Plotly. Truy vết cách R-to-Plotly xử lý xaxis rangebreaks và xác định liệu kết quả mong đợi có phải là ẩn các ngày bị thiếu trong khi vẫn giữ một range slider hoạt động hay không.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, r
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.