[R-plotly] Hovertemplate fails in violin plot
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I attempt to use the hovertemplate argument to format the hover text, but it cannot properly display.
However the argument works for type = "scatter". Similar issue was found in #1636 with box plot.
df <- tibble(x = sample(letters[1:3], 100, replace = T), y = rnorm(100))
df %>% plot_ly(
x = ~x,
y = ~y,
split = ~x,
type = 'violin',
box = list(
visible = TRUE
),
hovertemplate = "%{y}", # not work
hoveron = "kde",
jitter = 1,
alpha = 0.5,
spanmode = "hard"
)
)

Using text argument + hoverinfo will let the hover disappear completely
df %>% plot_ly(
x = ~x,
y = ~y,
split = ~x,
text = ~y, # using text argument
type = 'violin',
box = list(
visible = TRUE
),
hoverinfo = "text", # with hoverinfo
hoveron = "kde",
jitter = 1,
alpha = 0.5,
spanmode = "hard"
)
)

Using hoverinfo = "y" comes along with kde
df %>% plot_ly(
x = ~x,
y = ~y,
split = ~x,
type = 'violin',
box = list(
visible = TRUE
),
hoverinfo = "y",
hoveron = "kde",
jitter = 1,
alpha = 0.5,
spanmode = "hard"
)

However, hoverinfo = "x" works properly,
df %>% plot_ly(
x = ~x,
y = ~y,
split = ~x,
type = 'violin',
box = list(
visible = TRUE
),
hoverinfo = "x",
hoveron = "kde",
jitter = 1,
alpha = 0.5,
spanmode = "hard"
)

R version = 4.0.5, R-plotly version = 4.9.3
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere die bereitgestellten R-Violin-Plot-Beispiele und vergleiche ihr Hover-Verhalten mit dem funktionierenden Scatter-Fall und dem zugehörigen Box-Plot-Issue #1636. Verfolge die Violin-Hover-Behandlung vom R-Beispiel bis zum relevanten plotly.R-Einstiegspunkt; abgeschlossen, wenn hovertemplate und hoverinfo den angeforderten y-Text anzeigen, ohne die Hover-Informationen der KDE zu verlieren.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- r
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 38/100