plotly / plotly/plotly.R

ggplot2 point fill doesn't translate correctly

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

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

bug ggplotly
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ả

Summary

aes(color = z) works as expected.

aes(fill = z) does not, and it produces a warning.

Expected behavior

aes(color = z) works as expected.

library(ggplot2)
library(plotly)

set.seed(42)
d <- data.frame(
  x = rnorm(1000),
  y = rnorm(1000),
  z = rnorm(1000)
)

p <- ggplot(d, aes(x, y, color = z)) +
  geom_point(size = 3)

ggplotly(p)

image

Observed behavior

On the other hand, aes(fill = z) does not work as expected.

There are two issues:

  • All of the points are the same color
  • There is a warning message suggesting there's a bug somewhere
p <- ggplot(d, aes(x, y, fill = z)) +
  geom_point(shape = 21, size = 3)

ggplotly(p)
Warning message:
In L$marker$color[idx] <- aes2plotly(data, params, "fill")[idx] :
  number of items to replace is not a multiple of replacement length

image

R version 3.4.4 (2018-03-15)
Platform: x86_64-apple-darwin17.4.0 (64-bit)
Running under: macOS High Sierra 10.13.3

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /usr/local/Cellar/openblas/0.2.20_1/lib/libopenblasp-r0.2.20.dylib

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.7.1 ggplot2_2.2.1.9000 devtools_1.13.5 colorout_1.2-0

loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 pillar_1.2.1 compiler_3.4.4 plyr_1.8.4 bindr_0.1.1
[6] tools_3.4.4 digest_0.6.15 jsonlite_1.5 memoise_1.1.0 tibble_1.4.2
[11] gtable_0.2.0 viridisLite_0.3.0 pkgconfig_2.0.1 rlang_0.2.0.9001 rstudioapi_0.7
[16] shiny_1.0.5 crosstalk_1.0.0 yaml_2.1.18 bindrcpp_0.2.2 withr_2.1.2
[21] dplyr_0.7.4 httr_1.3.1 htmlwidgets_1.0 grid_3.4.4 glue_1.2.0
[26] data.table_1.10.4-3 R6_2.2.2 purrr_0.2.4 tidyr_0.8.0 magrittr_1.5
[31] scales_0.5.0.9000 htmltools_0.3.6 assertthat_0.2.0 xtable_1.8-2 mime_0.5
[36] colorspace_1.3-2 httpuv_1.3.6.2 labeling_0.3 lazyeval_0.2.1 munsell_0.4.3

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 bản tái hiện R được cung cấp với ggplotly và so sánh ánh xạ màu đang hoạt động với ánh xạ fill bị lỗi. Theo dõi quá trình chuyển đổi fill liên quan đến cảnh báo về việc thay thế màu marker; hoàn tất khi các điểm shape-21 nhận được các giá trị tô khác nhau từ z mà không có cảnh báo.

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

Đánh giá

Công nghệ
r
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
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.