plotly / plotly/plotly.R

Version 4.10.0 bug displaying hover text in output

Offen
#2,080 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
R
Sterne
2.7k
Forks
641
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

With version 4.10.0, there appears to be a bug that causes hover text to display in the output figure for bar plots. It seems that this is somehow related to the size of the bars and the window in which the figure is displayed. Adding textposition = "none" to the plot_ly() call seems to resolve this issue, however this was not required with the previous version (4.9.1).

Reproducible example using code from Text Mining with R:

library(tidyverse)
library(plotly)
library(tidytext)
library(janeaustenr)

austen_bigrams <- austen_books() %>%
  unnest_tokens(bigram, text, token = "ngrams", n = 2)

bigrams_separated <- austen_bigrams %>%
  separate(bigram, c("word1", "word2"), sep = " ")

bigrams_filtered <- bigrams_separated %>%
  filter(!word1 %in% stop_words$word) %>%
  filter(!word2 %in% stop_words$word)

# new bigram counts:
bigram_counts <- bigrams_filtered %>% 
  count(word1, word2, sort = TRUE)

bigrams_united <- bigrams_filtered %>%
  unite(bigram, word1, word2, sep = " ")

bigram_tf_idf <- bigrams_united %>%
  count(book, bigram) %>%
  bind_tf_idf(bigram, book, n) %>%
  arrange(desc(tf_idf)) %>%
  group_by(book) %>%
  slice_max(tf_idf, n = 10) %>%
  mutate(bigram = fct_reorder(bigram, tf_idf))

bigram_tf_idf %>%
  do(p = plot_ly(., x = ~tf_idf, y = ~bigram, color = ~book, type = "bar", hoverinfo = "text", text = ~paste(bigram, "<br> tf-idf: ", tf_idf))) %>%
  subplot(nrows = 3, shareX = FALSE, shareY = FALSE)

Snippet of the resulting figure:

plotly_bug

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Führen Sie das reproduzierbare R-Beispiel mit plot_ly() und subplot() aus und vergleichen Sie die Ausgabe des Balkendiagramms in den Versionen 4.10.0 und 4.9.1. Untersuchen Sie, warum Hover-Text in der Abbildung erscheint, obwohl hoverinfo = "text" gesetzt ist; das Issue ist erledigt, wenn das erwartete Hover-Verhalten funktioniert, ohne textposition = "none" hinzuzufügen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
r
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.