Bug: ggplotly with geom_line and custom tooltip does not show lines when tooltip varies per data point
まだ誰も着手していません。
評価
- 難易度
- 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 ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
plotly/plotly.R の issue をすべて見る
似ている issue
-
難易度 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 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 67/100