gpt4 book ai didi

从 plotly 对象中删除悬停信息文本

转载 作者:行者123 更新时间:2023-12-05 04:03:09 26 4
gpt4 key购买 nike

我正在 R 中创建一个 plotly 对象:

library(plotly)
p <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length, text = ~Species, hoverinfo="text",
marker = list(size = 10,
color = 'rgba(255, 182, 193, .9)',
line = list(color = 'rgba(152, 0, 0, .8)',
width = 2))) %>%
layout(title = 'Styled Scatter',
yaxis = list(zeroline = FALSE),
xaxis = list(zeroline = FALSE))

如您所见,它包含 hoverino

然后在某个时候我想删除那个 hoverinfo 层。

知道怎么做吗?

最佳答案

style(hoverinfo = 'none')

所以把它们放在一起:

(p <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length, text = ~Species, hoverinfo="text",
marker = list(size = 10,
color = 'rgba(255, 182, 193, .9)',
line = list(color = 'rgba(152, 0, 0, .8)',
width = 2))) %>%
layout(title = 'Styled Scatter',
yaxis = list(zeroline = FALSE),
xaxis = list(zeroline = FALSE)) %>%
style(hoverinfo = 'none'))

关于从 plotly 对象中删除悬停信息文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53787679/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com