I’m trying to recreate a graph created with ggplot() with plot_ly() (n a Shiny app).
It’s a horizontal bar chart, with some bars having a negative value. The hover text shows for the bars with positive values but not for bars with negative values.
ppxx ← dd %>%
plot_ly( x = ~dd$heights, y = ~dd$Names, color = ~dd$Enriched, type = “bar”, orientaton = “h”,
hoverinfo = “text”, text = my_text ) %>%
add_markers( x = ~dd$low - 0.5, y = ~dd$Names, marker = list(symbol=142, color=“black”), showlegend = FALSE ) %>%
add_markers( x = ~dd$high - 0.5, y = ~dd$Names, marker = list(symbol=142, color=“black”), showlegend = FALSE,
hoverinfo = “none” ) %>%
add_segments( x = ~dd$low - 0.5, xend = ~dd$high - 0.5, y = ~dd$Names, yend = ~dd$Names, color = toRGB(“black”),
showlegend = FALSE, hoverinfo = “none”) %>%
layout(title =NULL, xaxis = my.xaxis, margin = list(l=120,t=50,b=30,unit=“pt”,pad=2),
yaxis = list(title=“”))
ppxx
Full code is at plot_ly barchart, hover not displaying on negative values · GitHub
deployed at https://tamilyn.shinyapps.io/dash