Bug: ggplotly with geom_line and custom tooltip does not show lines when tooltip varies per data point
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- r
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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)
- 主要語言
- R
- 星號
- 2.7k
- 分支
- 641
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
plotly/plotly.R 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 62/100
-
難度 3/5 1-2 天 新手友好度 45/100
-
難度 4/5 3-5 天 新手友好度 35/100
-
難度 3/5 1-2 天 新手友好度 68/100
-
難度 3/5 1-2 天 新手友好度 72/100
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 78/100
pharmaverse/teal.picks#147 · 1 個 reaction ·
-
難度 2/5 1-3 小時 新手友好度 75/100
pharmaverse/admiralonco#367 ·
-
難度 2/5 1-3 小時 新手友好度 68/100
waldronlab/bugphyzz#301 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
-
難度 2/5 1-3 小時 新手友好度 78/100
r-lib/tree-sitter-r#209 ·