英文:
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
英文:
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
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论