plotly / plotly/plotly.R

ggplotly() cannot stop geom_text tooltip, geom will not display on all animation frames

Đang mở
#2,060 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ả

  1. Cannot stop geom_text from displaying tooltip.
  2. Animations will not display all geoms on all frames (note that data has differing rownumers
library(ggplot2)
library(plotly)
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout

df_txt <- data.frame(x=1, y=1, label="No tooltip here, please", frame = 1:2)
df_pts <- data.frame(x=rep(c(1, 1), each=2), y=c(.9, .95, .8, .85),
                     tooltip=paste("obs_num: ", 1:2, "tooltip exclusively for points with different dim"),
                     frame = rep(1:2, each=2))

## static plot, no frames
g <- ggplot() +
  geom_text(aes(x,y, label=label), df_txt) +
  geom_point(aes(x,y, tooltip=tooltip), df_pts)
#> Warning: Ignoring unknown aesthetics: tooltip

plotly::ggplotly(g, tooltip = "tooltip")

## Issue 1) geom_text tooltips are unstopable:
plotly::ggplotly(g, tooltip = NULL)

# plotly::ggplotly(g, tooltip = FALSE)
# plotly::ggplotly(g, tooltip = "foobar")

## animation, aes has frame
g_anim <- ggplot() +
  geom_text(aes(x,y, label=label, frame = frame), df_txt) +
  geom_point(aes(x,y, tooltip=tooltip, frame = frame), df_pts)
#> Warning: Ignoring unknown aesthetics: frame
#> Warning: Ignoring unknown aesthetics: tooltip, frame

## Issue 2) seeing common frame 1 issues, where some geoms display only on frame 1.
# then other apeear semi consistently in other frames. 
plotly::ggplotly(g_anim, tooltip = "tooltip")

## Not a tooltip issue as I was worrying.
g_anim2 <- ggplot() +
  geom_text(aes(x,y, label="existential crisis with points and text", frame = frame), df_txt) +
  geom_point(aes(x,y, frame = frame), df_pts)
#> Warning: Ignoring unknown aesthetics: frame
#> Warning: Ignoring unknown aesthetics: frame
plotly::ggplotly(g_anim2)

Created on 2021-10-28 by the reprex package (v2.0.1)

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

Bắt đầu bằng cách chạy các bản tái hiện R được cung cấp cho ggplotly(), g, g_anim và g_anim2. Theo dõi cách ggplotly() xử lý tooltip và frame aesthetics; hoàn tất khi có thể suppress tooltip của geom_text và mọi geom đều xuất hiện trên mọi animation frame, kể cả khi dữ liệu frame có số hàng khác nhau.

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.