【问题标题】:Removing buttons from plotly modebar从情节模式栏中删除按钮
【发布时间】:2021-04-06 16:25:20
【问题描述】:

我正在尝试从 scatter3D 图中删除 plotly 模式栏中的轨道旋转按钮。根据the manual (26.3 Remove modebar buttons by name),这听起来是可行的。然而,当我尝试它时,情节就消失了。常规 scatter3d 图:

fig <- plot_ly(mtcars, x = ~wt, y = ~hp, z = ~qsec, color = ~am, colors = c('#BF382A', '#0C4B8E'))
fig <- fig %>% add_markers()
fig

但是当我尝试使用名称列表删除按钮here 时,情节消失了(模式栏也是如此):

fig %>%
  config(modeBarButtonsToRemove = c("orbitRotation"))

它似乎适用于某些按钮,但不适用于其他按钮 - 这是一个错误吗?

【问题讨论】:

    标签: r plotly r-plotly


    【解决方案1】:

    如果只删除一个按钮,这将失败。 See this github issue。如果您将按钮名称放入列表中,它应该可以工作:

    fig %>%
      config(modeBarButtonsToRemove = list("orbitRotation"))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-10
      • 1970-01-01
      • 2020-03-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多