issue: position_dodge alters hover values
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ả
Problem: using position_dodge in at least geom_point seems to incorrectly assign the group values shown when hovering on a point. This is related to whether or not the values in the plot x-axis factor are alphabetically ordered.
Example:
library(ggplot2)
library(plotly)
#Data with x-axis factor in alphabetical order (a, b, c):
data <- data.frame('Col1' = c('a', 'b', 'c'), 'Col2'= factor(1:3), Col3 = c('A1', 'A2', 'A3'), 'Val' = c(10,5,1))
#Hovering on plot dots gives correct values, regardless of position_dodge.
ggplotly(ggplot(data, aes(x = Col1, y = Val, group = Col2:Col3)) + geom_point())
ggplotly(ggplot(data, aes(x = Col1, y = Val, group = Col2:Col3)) + geom_point(position = position_dodge(0.6)))
#Data with x-axis factor in non alphabetical order (c, a, b):
data1 <- data.frame('Col1' = c('c', 'a', 'b'), 'Col2'= factor(1:3), Col3 = c('A1', 'A2', 'A3'), 'Val' = c(10,5,1))
#Hovering on plot dots gives correct values if no position_dodge is used:
ggplotly(ggplot(data1, aes(x = Col1, y = Val, group = Col2:Col3)) + geom_point())
#Hovering on plot dots gives incorrect values (as if the x-axis levels had been reordered?) if position_dodge is used:
ggplotly(ggplot(data1, aes(x = Col1, y = Val, group = Col2:Col3)) + geom_point(position = position_dodge(0.6)))
Both solution and temporary workaround are appreciated. Plotly is superb, thank you so much for putting your time on it.
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 bằng cách chạy hai ví dụ ggplotly sử dụng geom_point và position_dodge, so sánh các trường hợp Col1 theo thứ tự bảng chữ cái và không theo thứ tự bảng chữ cái. Theo dõi cách ggplotly chuyển dữ liệu điểm được nhóm vào các giá trị hover; hoàn thành khi các giá trị nhóm được hiển thị vẫn khớp với đúng các điểm khi sử dụng position_dodge.
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