plotly / plotly/plotly.R

Version 4.10.0 bug displaying hover text in output

Open
#2,080 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the reproducible R example using plot_ly() and subplot() and compare the bar-plot output in versions 4.10.0 and 4.9.1. Investigate why hover text appears in the figure despite hoverinfo = "text"; the issue is done when the expected hover behavior works without adding textposition = "none".

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.