# Mode lines, modeBarButtonsToAdd: \['select2d'\] -- not working

**URL:** <https://community.plotly.com/t/mode-lines-modebarbuttonstoadd-select2d-not-working/18226>\
**Category:** plotly.js\
**Created:** [January 17, 2019, 5:22pm UTC](https://community.plotly.com/t/mode-lines-modebarbuttonstoadd-select2d-not-working/18226 "2019-01-17T17:22:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![leszek](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@leszek](https://community.plotly.com/u/leszek)\
**Post date:** [January 17, 2019, 5:22pm UTC](https://community.plotly.com/t/mode-lines-modebarbuttonstoadd-select2d-not-working/18226/1 "2019-01-17T17:22:39Z")

</div>

Button ‘select2d’ = ‘Box Select’ disappears when trace mode is ‘line’.  
How to show that button anyway?  
I have tried everyway I could think of, no success, so please help.

Here is code pen:

https://codepen.io/leszek1234/embed/preview/WLBypr?height=300&slug-hash=WLBypr&default-tabs=js,result&host=https://codepen.io

and here is the code:

```
Plotly.newPlot(

```

‘myDiv’,  
[  
{ x: [1, 2, 3], y: [10, 20, 30], mode: ‘lines’},

```
// don't want to uncomment this line to show Box Select
// { x: [2], y: [12], mode: 'markers'}

```

],  
{}, // layout  
{  
displayModeBar: true,

```
// how to add button select2d
// modeBarButtonsToAdd: ['select2d'],

// this works normally 
// modeBarButtonsToRemove: ['select2d'],

```

}  
)

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [January 17, 2019, 7:57pm UTC](https://community.plotly.com/t/mode-lines-modebarbuttonstoadd-select2d-not-working/18226/2 "2019-01-17T19:57:04Z")

</div>

Right, selection isn’t supported for `mode:'lines'` scatter traces, so that button is removed.

---

<div class="post-metadata">

**Author:** ![leszek](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@leszek](https://community.plotly.com/u/leszek)\
**Post date:** [January 17, 2019, 8:14pm UTC](https://community.plotly.com/t/mode-lines-modebarbuttonstoadd-select2d-not-working/18226/3 "2019-01-17T20:14:24Z")

</div>

But if I add only one point everything works fine. I just need to grab “range” from selection.  
It would be nice just to be able to turn that selection button on.

object-of-selection-range.x[0, 1]

Why I need this? Because I calculate the field below the lines and user sets selection on x axis.

Something like this: [https://i.stack.imgur.com/rMRkE.png](https://i.stack.imgur.com/rMRkE.png)  
[https://i.stack.imgur.com/rMRkE.png](https://i.stack.imgur.com/rMRkE.png)

![a](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/8/817ae5afc6b0178375df96a8edf9f05798d88ee7.png)

---

<div class="post-metadata">

**Author:** ![plasmapotential](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@plasmapotential](https://community.plotly.com/u/plasmapotential)\
**Post date:** [May 26, 2022, 3:31pm UTC](https://community.plotly.com/t/mode-lines-modebarbuttonstoadd-select2d-not-working/18226/4 "2022-05-26T15:31:53Z")

</div>

I feel like this should be supported. The underlying data points that comprise the line are still there. Why can’t I select them even if my plot doesn’t show markers?
