ggplotly can omit geom_lines when they are colour coded within groups
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ả
Create a ggplot graph in which geom_line objects connect data points within a grouping variable and when colour is also mapped to a variable. i.e. the output is a grid of dots in which dots at the same height are connected by horizontal lines:

When passed to the ggplotly function, however, the lines are often omitted. In the reproducible example below, all the lines are omitted, but in other examples, sometimes just individual lines fail to plot. In this example, lines, but not points, do appear in the legend:

To isolate the problem, in the example below, if the colour = time parameter is dropped from the aes() function, then the lines (in monochrome) do get displayed.
library(ggplot2)
library(dplyr)
library(plotly)
# a dataframe with multiple values per case:
d = data.frame(case = as.factor(rep(1:5, each = 4)),
time = as.factor(rep(1:4, times = 5)))
p = d %>%
ggplot(aes(x = time, y = case, colour = time)) +
# produce lines to link points within a case:
geom_line(aes(group = case)) +
geom_point()
print(p) # standard ggplot output includes both lines and points
ggplotly(p) # but plotly output omits lines when colour is specified
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với ví dụ R có thể tái lập sử dụng ggplotly(), geom_line(), geom_point() và ánh xạ colour vào time; so sánh đầu ra của ví dụ này với biến thể đường đơn sắc. Theo dõi cách ggplotly chuyển đổi các layer geom_line được nhóm, sau đó xác minh rằng tất cả các đường được nhóm đều xuất hiện khi colour được ánh xạ, đồng thời các điểm và chú giải vẫn chính xác.
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
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 45/100