Controlling Animation for Points When There Are Missing Values (ggplotly)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- r
- Lĩnh vực
- data-visualization
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 cả plot_ly() và ggplotly(), bao gồm animation_opts() và animation_slider(). So sánh danh tính của các điểm và nhãn hover giữa Jan 2021 và Feb 2021 khi có các hàng bị thiếu. Được xem là hoàn tất khi hành vi đã được giải thích và đã xác định được một cách có tài liệu để giữ nguyên danh tính của Clinic, hoặc một fix có phạm vi giới hạn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I am building a Hans Rosling type visualisation, however, I am having issues with the point movements. I have attached some code that creates an example of my problem, which can be found below.
The best way I can describe it is that whenever there is a missing value, a point has to disappear, therefore a different becomes assigned to a point even if it's in a different group. This logically doesn't make any sense to me.
In the example below, I've removed the Month Year of Feb 2021 from Clinic A, (i.e. I've removed the whole row), which means that the point disappears as shown in the play animation movement. However, if you notice instead of the Clinic A point simply disappearing, it chooses to keep the Clinic A point, turn into a different Clinic, in this case Clinic B and also convert the surrounding points to different clinics as well. I think it's working off the logic of turn into whatever point is the nearest somehow.
To really understand what is happening observe the hover of the points from Jan 2021 to Feb 2021
My question(s) is/are:
- Why is this happening?
- How do I specify some sort of group or ID to the points so that they aren't randomly turning into other Clinics?
In my real world scenario I have over 90+ different unique IDs/Clinics so ideally someone would be able to press play and then follow a single point moving across the viz, specifically noticing for any abnormalities in movement. It's extremely difficult to do this, or rather almost impossible, if a given point is converting itself into another point on the fly.
Note: I have confirmed this problem is replicated when using both plot_ly() and ggplotly() and only seems to happen when there is missing data
Code to Replicate Problem:
set.seed(24)
test <- data.frame(Month_Year = rep(paste(month.abb, rep(2021:2022, each = 12), sep = "_"), 4),
x = abs(rnorm(24*4)),
y = abs(rgamma(24&4,2,1)),
Clinic = rep(c("Clinic A", "Clinic B", "Clinic C", "Clinic D"), each = 24))
test$Month_Year <- factor(test$Month_Year, levels = paste(month.abb, rep(2021:2022, each = 12), sep = "_"))
test <- test[-c(2,8,12),]
pt <- test %>%
ggplot(aes(x = x, y = y, frame = paste0(sprintf("%02d", as.numeric(Month_Year)), Month_Year), text =
paste(
"RAR:", round(y, 3),
"\nMR:", round(x, 3),
"\nClinic:", Clinic
))) +
geom_point(shape = 1, color = "firebrick", aes(group = Clinic)) +
# geom_text(aes(y = NAG + 5)) +
theme_minimal() +
labs(x = "Rolled Mortality Rate - 3 Month Average", y = "Rolled Admission Rate - 3 Month Average") +
scale_x_continuous(limits = c(0, 6))
ggplotly(pt, tooltip = "text") %>%
animation_opts(
3000,
redraw = T
) %>%
animation_slider(
currentvalue = list(prefix = "Month Year: ")
)
- 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
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.
Issue khác của plotly/plotly.R
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
Data gets dropped in add_trace and consequently points have the wrong color if NA is present Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
-
save_image Error Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
Tất cả issue của plotly/plotly.R
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
robjhyndman/forecast#1220 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
JamesHWade/deputy#192 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
bug triage_needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
pharmaverse/rtables#1123 · 1 bình luận · 1 reaction ·