我的数据:
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))
字符串
问题在于,在HoverInfo中,医院区域显示两次,同时显示为color
和y
fig <- plot_ly(df, x = ~Count, y = ~`Hospital Region`, type = 'bar', orientation = 'h',color=~`Hospital Region`)
fig
型
1条答案
按热度按时间6rqinv9w1#
您可以指定
hoverinfo = "text"
,然后在text
中指定要在悬停时显示的列。字符串
的数据