title: How to add a modebar button in plotly in R?
body: <p>I would like to create custom modebar buttons for heatmap graphs (e.g., box selection, lasso selection). It is possible to edit specific Mode Bar buttons through the <a href="https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js" rel="nofollow noreferrer">config</a> argument <a href="https://github.com/plotly/plotly.js/blob/master/src/components/modebar/buttons.js" rel="nofollow noreferrer">descriptions</a>, but I don't know how to implement this javascript code to add buttons in R.</p>
  
  <p>You can set dragmode to "select":</p>
  
  <pre><code>p = plot_ly(z = matrix(runif(100), 10, 10), type = "heatmap") %&gt;%
  layout(dragmode =  "select")
  </code></pre>
  
  <p>which gives the desired behavior, but if you select any other tools, you can’t get back to the select tool.</p>