Remove the rectangle drawn on the chart plotly within Shiny.

huangapple go评论64阅读模式
英文:

Remove the rectangle drawn on the chart plotly within Shiny

问题

I can draw a triangle with one click, I can change its shape, but how do I delete this rectangle?

library(plotly)

x <- 1:50
y <- rnorm(50)

fig <- plot_ly(x = ~x, y = ~y, type = 'scatter', mode = 'lines')
fig <- config(fig,modeBarButtonsToAdd = list('drawrect'))

fig

Remove the rectangle drawn on the chart plotly within Shiny.

英文:

I can draw a triangle with one click, I can change its shape, but how do I delete this rectangle?

library(plotly)

x <- 1:50
y <- rnorm(50)

fig <- plot_ly(x = ~x, y = ~y, type = 'scatter', mode = 'lines')
fig <- config(fig,modeBarButtonsToAdd = list('drawrect'))

fig

Remove the rectangle drawn on the chart plotly within Shiny.

答案1

得分: 2

你需要添加按钮 eraseshape

config(fig, modeBarButtonsToAdd = list('drawrect', 'eraseshape'))

然后选择矩形,点击此按钮。

英文:

You have to add the button eraseshape:

config(fig,modeBarButtonsToAdd = list('drawrect', 'eraseshape'))

then select the rectangle and click this button.

huangapple
  • 本文由 发表于 2023年5月22日 17:44:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76304893.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定