R Plotly 默认取消选择跟踪

标签 r plotly

我正在使用 R Plotly 并有一行表格:

add_trace(y = meanRank,
          x = DateOnly,
          data = timeSeriesDF,
          name = "Daily Value",
          text = hoverText,
          hoverinfo = "text",
          showlegend = TRUE)

它工作正常。但是,我希望在显示绘图时“未选择”此跟踪。因此,用户将在图例上单击它以显示该行。我似乎无法找到显示该参数的参数。

最佳答案

您可以添加 visible = "legendonly" :

library(plotly)
economics %>%
 transform(rate = unemploy / pop) %>%
 plot_ly(x = date, y = rate) %>%
 loess(rate ~ as.numeric(date), data = .) %>%
 broom::augment() %>%
 add_trace(y = .fitted, name = "foo", visible = "legendonly")

enter image description here

reference .

关于R Plotly 默认取消选择跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39625910/

相关文章:

r - 搜索 R 包的最佳方式?

r - 如何自动填充空白栏

r - 无法在 r markdown 中编译 tex

plotly - F# 交互式笔记本不显示 Plotly 图表

python - Plotly 表达条形图颜色变化

python - 颜色条最小值和最大值

r - Plotly 绘图不会在 RMarkdown 文档的 for 循环内渲染

r - 如何在 data.frame 中创建一个新列,以便该列计算该 data.frame 中不同行的数量?

r - 在 .Rmd 文件中使用 knitr 有条件地评估航向

python - 将水平线添加到 Dash-Plotly Python 仪表板