# Custom Button to Filter Plot Data

**URL:** <https://community.plotly.com/t/custom-button-to-filter-plot-data/54551>\
**Category:** Dash Python\
**Created:** [July 7, 2021, 6:33pm UTC](https://community.plotly.com/t/custom-button-to-filter-plot-data/54551 "2021-07-07T18:33:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![maguirem](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@maguirem](https://community.plotly.com/u/maguirem)\
**Post date:** [July 7, 2021, 6:33pm UTC](https://community.plotly.com/t/custom-button-to-filter-plot-data/54551/1 "2021-07-07T18:33:53Z")

</div>

I’m trying to find a solution within Plotly/Dash where I can filter the incoming data for a plot with the selection of a custom button.

For example, consider the following data:

```auto
 x | y | Special

.23 .55 N
.11 .89 Y
.45 .34 Y
.91 .21 N

```

How could I make an ‘updatemenu’ addition to my plots that displays only the data points where Special=‘Y’ with one button selection or all of the points with another selection’?

What I have now:

```auto

my_figure.update_layout(
                updatemenus=[
                    dict(
                        buttons=list([
                            dict(
                                args=[<unknown> (filter function goes here?)],
                                label="Only Special Data",
                                method="restyle"
                            ),
                            dict(
                                args=[<unknown> (filter function goes here?)],
                                label="All Data",
                                method="restyle"
                            )
                        ]),
                    ),
                ]
            )

```

I’m new to the custom button feature of Plotly so any help would be greatly appreciated!
