Bug: ggplotly with geom_line and custom tooltip does not show lines when tooltip varies per data point
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- r
- Ambito
- data-visualization
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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)
- Lingua principale
- R
- Stelle
- 2.7k
- Fork
- 641
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di plotly/plotly.R
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
Tutte le issue di plotly/plotly.R
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
pharmaverse/admiralonco#367 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
waldronlab/bugphyzz#301 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
r-lib/tree-sitter-r#209 ·
-
Suggest rmoriebricklayerAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 67/100