Updating Dash Datatable based on Scatter_Mapbox Selection


I am new to dash so my apologies for the basic questions.

I have a map generated via px.scatter_mapbox. I have a dash data table that uses the same dataframe that fed the map.

I would like people to select a dot (or group select dots) on the map, and then have the data table filter based on that selection.

I have been having a hard time finding a working example, so I am unsure where to begin. I have enabled ‘’‘clickmode = “event+select”’’’ in the map, but I am unsure how to do the callbacks. Can someone point me in the right direction?


Hi @plotlynoob

There are few options available to filter out based on the graph data points.
Check this out Part 4. Interactive Graphing and Crossfiltering | Dash for Python Documentation | Plotly.
Once you have the data from the graph you can then use the conditional formatting of the dash datatable to highlight the rows.

@ atharvakatre

Thank you for the links. I will have a look.

My main goal is to use elements from a graph/map to filter a datatable that is being fed a different dataset. So for example, if a datatable is 200 records long, and the person hits point “x” on the map, then only point “x” records in the 200 records datatable will appear.

I will create a reproducible example if I have any problems.


1 Like

So I am able to retrieve specific data elements, and filter the datatable based on that click, so that is good!

But when I use selection, it only grabs the first specific element it encounters, instead of all within the selection.

I am using this code to access elements instead of json.dumps():


Do you have any thoughts?