plotly.R icon indicating copy to clipboard operation
plotly.R copied to clipboard

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

Open jillahmad17 opened this issue 2 years ago • 1 comments

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

jillahmad17 avatar May 15 '23 18:05 jillahmad17

Indeed, that does not work. I also tried with customdata and hovertemplate, same result.

You should rather ask this question on StackOverflow or/and Posit Community. Github issues are rather for bug reports and feature requests.

stla avatar Sep 07 '23 12:09 stla