Bug: ggplotly with geom_line and custom tooltip does not show lines when tooltip varies per data point
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
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- r
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Start by running the three reproductions in the issue. Compare the trace that ggplotly() builds for geom_point against geom_line when the text aesthetic varies, for example by inspecting plotly_build() output. The fault is probably in how the line trace's hover text is converted, not in the plot itself. Done when a geom_line with a per-point tooltip renders its line and the tooltip still works.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hello,
I have stumbled across a very strange little bug, if I try to make a custom tooltip on a plot converted from ggplot2 with ggplotly, then it works fine with geom_point but breaks (nothing is plotted) with geom_line. But, only when the text of the tooltip varies with the data.
For example, here we have everything working as expected with geom_point:
library(plotly)
p <- mtcars |>
mutate(
text = paste0("test: ", row.names(mtcars))
) |>
ggplot(aes(x = disp, y = mpg, text = text)) +
geom_point()
ggplotly(p, tooltip = "text")
However, if I now use geom_line instead, the data disappears even though it must be there as the tooltip works:
library(plotly)
p <- mtcars |>
mutate(
text = paste0("test: ", row.names(mtcars))
) |>
ggplot(aes(x = disp, y = mpg, text = text)) +
geom_line()
ggplotly(p, tooltip = "text")
But, if I change the tooltip text back so that it's a constant string (i.e. doesn't change with the data) then everything plots fine, again.
library(plotly)
p <- mtcars |>
mutate(
text = paste0("test: ", "constant")
) |>
ggplot(aes(x = disp, y = mpg, text = text)) +
geom_line()
ggplotly(p, tooltip = "text")
What's even weirder is that the plotting will work fine with a varying tooltip, but only when it's the default tooltip:
library(plotly)
p <- mtcars |>
mutate(
text = paste0("test: ", "constant")
) |>
ggplot(aes(x = disp, y = mpg)) +
geom_line()
ggplotly(p)
- 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
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc 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ó 3/5 1-2 ngày Mức phù hợp với người mới 45/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
Tất cả issue của plotly/plotly.R
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
pharmaverse/teal.picks#147 · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
pharmaverse/admiralonco#367 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
waldronlab/bugphyzz#301 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
r-lib/tree-sitter-r#209 ·