my data :
df<-structure(list(`Hospital Region` = structure(1:8, levels = c("LA-Santa Barbara-Ventura",
"Mid-Coastal", "North Coast-East Bay", "Northeastern", "Orange",
"San Diego-Imperial", "Southern Central Valley", "Southern Inland"
), class = "factor"), Count = c(14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L)), class = "data.frame", row.names = c(NA, -8L))
the issue is that in hoverinfo the hospital region is displayd twice as both color
and y
fig <- plot_ly(df, x = ~Count, y = ~`Hospital Region`, type = 'bar', orientation = 'h',color=~`Hospital Region`)
fig
You may specify hoverinfo = "text"
and then specify columns in text
as what you want to show on hover.
library(plotly)
fig <- plot_ly(df, x = ~Count, y = ~`Hospital Region`, type = 'bar',
orientation = 'h',color=~`Hospital Region`,
hoverinfo = "text", text = ~`Hospital Region`)
fig