Skip to content

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

Open
@jillahmad17

Description

@jillahmad17

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions