plotly / plotly/plotly.R

Version 4.10.0 bug displaying hover text in output

Aperta
#2,080 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
R
Stelle
2.7k
Fork
641
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Esegui l’esempio R riproducibile usando plot_ly() e subplot() e confronta l’output del grafico a barre nelle versioni 4.10.0 e 4.9.1. Analizza perché nella figura appare del testo al passaggio del mouse nonostante hoverinfo = "text"; l’issue è completata quando il comportamento previsto al passaggio del mouse funziona senza aggiungere textposition = "none".

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
r
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.