plotly / plotly/plotly.R

Plot does not show hoverinfo for first data point when default hovermode or set to 'closest'

Open
#1,833 0 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

As written in the title, the hoverinfo for the first (bottom left) data point when layout.hovermode= 'closest' or kept as default does not appear.

# call library
library(plotly)

# reset fig
fig <- NULL

# add an extra line to check behavior on right hand side of graph
cars_one_extra_line <- rbind(cars,c(25,90))

# plot
fig <- plot_ly(cars_one_extra_line)
fig <- fig %>% add_trace(x = ~speed, 
                         y = ~dist, 
                         color = ~dist,
                         colors = 'RdBu',
                         type = 'scatter',
                         mode = 'markers')
fig <- fig %>% layout(hovermode = "closest") 
fig

This is shown in the screenshot below. If the cursor is moved to the point above, the hoverinfo appears.
Screen Shot 2020-08-04 at 20 15 37

In an effort to understand the behavior, I also tried other tags. Strangely, the hovermode = 'y' also seems to have a weird behavior. Things to note are the following:

  • text is tilted,
  • text is sometimes obscured beyond the viewing frame (not shown in this example but does occur in certain cases),
  • text is sometimes shown twice but in two places,
  • y axis position is not always shown (for points at the top and bottom of the chart)

Screen Shot 2020-08-04 at 20 13 14
Screen Shot 2020-08-04 at 20 13 03

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 provided R reproduction with plot_ly, scatter markers, and hovermode set to "closest" or "y" to confirm the missing and malformed hover behavior. Trace the hover rendering path used by the R package and its interactive graph output; done means the first point displays hoverinfo and the reported hovermode cases render consistently without clipping, duplication, or missing axis positions.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization, frontend
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.