plotly / plotly/plotly.R

ggplotly does not respect the `width` of tiles, fills the "no data" range instead

Đang mở
#1,957 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ả

ggplotly does not respect the width value used for tiles. In the examples, the tiles should have a constant width, but converting the visualisation with ggplotly() results in a different visualisation, in which the areas with no data associated are "filled in" by the bordering tiles. It looks like the tiles expand on both sides equally, just enough to fill the empty space.

Note that what is meant by "no data" here is different to "missing data": the x value has no corresponding row in the dataset.

library(ggplot2)
library(plotly)
# default tile width
(default_width <- ggplot(mapping = aes(x = c(1, 2, 4), y = 1, fill = 1:3)) +
   geom_tile())

Convert to plotly:

ggplotly(default_width)

default

If one provides a custom width for the tiles, ggplotly() still ignores it:

# custom tile width
(custom_width <- ggplot(mapping = aes(x = c(1, 2, 4), y = 1, fill = 1:3)) +
    geom_tile(width = .5))

Convert to plotly:

ggplotly(custom_width)

custom

This does not happen if doing something similar with geom_col().

Using:

  • R 4.1.0
  • ggplot2 3.3.3
  • plotly 4.9.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

Tái hiện vấn đề bằng các ví dụ R sử dụng ggplotly() và geom_tile(), so sánh các trường hợp chiều rộng mặc định và tùy chỉnh với hành vi của geom_col(). Theo dõi quá trình chuyển đổi chiều rộng của các tile bởi ggplotly() và xác minh rằng các khoảng trống tương ứng với các giá trị x không có hàng vẫn để trống, đồng thời geom_tile(width = .5) được tôn trọ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ệ
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
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.