plotly / plotly/plotly.R

Unexpected behavior with geom_rect and ids arg in ggplotly()

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

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

difficulty: high ggplotly priority: low
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ả

Expected behavior demonstrated by geom_point. See ggplotly(gg1) below.

Unexpected behavior when using geom_rect with the ids arg across frames with changing number of observations. See ggplotly(gg2) and ggplotly(gg3) below.

### Win 10 x64, Rstudio
library(ggplot2) # ggplot2_3.0.0 
library(plotly)  # plotly_4.7.1
data(gapminder, package = "gapminder")

# filtering out some countries (soframes have differing number of obs)
sub_countries <- unique(gapminder$country)[1:10]
gapminder2 <- gapminder %>% 
  filter(((year != 1952) | (country %in% sub_countries)) & year < 1970)

# using geom_point (works)
gg1 <- ggplot(gapminder2) +
  geom_point(aes(x = gdpPercap, y = lifeExp, 
                 ids = country,
                 frame = year)) +
  scale_x_log10()
ggplotly(gg1) # correct: sub, full, full, full

# using geom_rect (doesn't work with ids arg)
gg2 <- ggplot(gapminder2) +
  geom_rect(aes(xmin = gdpPercap, ymin = lifeExp, 
                xmax = 1.05 * gdpPercap, ymax = 1.05 * lifeExp, 
                ids = country,
                frame = year))  +
  scale_x_log10()
ggplotly(gg2) # incorrect: sub, sub, sub, sub

# using geom_rect, subset on 2nd frame (doesn't work with ids arg)
gapminder3 <- gapminder %>% 
  filter(((year != 1957) | (country %in% sub_countries)) & year < 1970)

gg3 <- ggplot(gapminder3) +
  geom_rect(aes(xmin = gdpPercap, ymin = lifeExp, 
                xmax = 1.05 * gdpPercap, ymax = 1.05 * lifeExp, 
                ids = country,
                frame = year))  +
  scale_x_log10()
ggplotly(gg3) # incorrect: full, sub moves, full, full
  # frame year 1952 -> 1957 != 1962 -> 1957 != 1967 -> 1957

Cheers,
Nick

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

Chạy bản tái hiện R được cung cấp với ggplot2 và plotly, so sánh geom_point và geom_rect giữa các frame có số lượng observation thay đổi. Theo dõi đường dẫn chuyển đổi ggplotly cho geom_rect, ids và việc xử lý frame. Hoàn thành khi geom_rect giữ nguyên các observation và ids chính xác trong mọi frame, phù hợp với hành vi mong đợi đã được minh họa.

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
45/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.