【发布时间】:2021-12-24 05:59:19
【问题描述】:
我们能否让这些值仅在悬停时可见。示例“Toyota Corolla”仅在悬停时可见。现在所有的值都出现了
library(plotly)
data <- mtcars[which(mtcars$am == 1 & mtcars$gear == 4),]
fig <- plot_ly(data, x = ~wt, y = ~mpg, type = 'scatter', mode = 'markers',
marker = list(size = 10))
fig <- fig %>% add_annotations(x = data$wt,
y = data$mpg,
text = rownames(data),
xref = "x",
yref = "y",
showarrow = TRUE,
arrowhead = 4,
arrowsize = .5,
ax = 20,
ay = -40,
# Styling annotations' text:
font = list(color = '#264E86',
family = 'sans serif',
size = 14))
fig
【问题讨论】:
-
看起来这是 ggplots。不确定这是否可以复制