【发布时间】:2020-06-01 22:09:42
【问题描述】:
我在 R 中使用 Plotly 制作散点图,但目前当我将鼠标悬停在闪亮应用程序中的点上时,会出现与 x,y 值对应的值。例如 (19, 27.73k)。但是,我想将其更改为也显示与该数据对应的列。 ex (USA, 19, 27.73k) 这可能吗? IDK(如果相关但当前标记代码)
mode="markers",
marker = list(
opacity = 0.5,
size = 5
)) %>%
【问题讨论】:
-
这是here
library(plotly) fig <- plot_ly(type = 'scatter', mode = 'markers') fig <- fig %>% add_trace( x = c(1:5), y = rnorm(5, mean = 5), text = c("Text A", "Text B", "Text C", "Text D", "Text E"), hoverinfo = 'text', marker = list(color='green'), showlegend = F ) fig的摘录 为了为您的数据提供解决方案,使用 dput 或其他方式获取一些示例数据会有所帮助。