plotly / plotly/plotly.R

hoverinfo not working - unable to reproduce franconia plotly map with correct hover information

Open
#2,267 1 comment 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

I am building a map using plot_ly and am unable to correctly display information using text and hoverinfo. To debug, I tried to recreate this map found on this website:
https://blog.cpsievert.me/2018/03/30/visualizing-geo-spatial-data-with-sf-and-plotly/

plot_ly(
  franconia,
  split = ~NUTS_ID,
  color = ~district,
  stroke = I("black"),
  text = ~paste(NAME_ASCI, "\n is in", district), 
  hoverinfo = "text",
  hoveron = "fill"
)

however only the nuts_id information is showing.

Thus, when I run this code:

 plot_ly(data = full_pov_census_data, 
            split =~NAME, 
            color =~NumbImpoverished,
            showlegend = FALSE,
            alpha = 1,
            type = 'scatter',
            mode = 'lines') 

only the NAME variable shows up when I hover.

Do you mind helping me solve this problem?

Thank you in advance

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

Start with the two supplied plot_ly examples and compare their split, text, hoverinfo, hoveron, and mode settings with the linked Franconia example. Reproduce the behavior using the franconia and full_pov_census_data inputs; the issue is done when the intended text and district or poverty information appears on hover rather than only the name or NUTS_ID.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.