✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

How can I change the color of selected points in scatterplots?

In Jupyter Notebook I’d like to change the color of selected points/markers with FigureWidget on_selection() events (similar to on_click event). E.g. the bubble-scatter-plot example shows how to assign colors to all scatterplot markers via scatter marker color. But how can I change the color of a specific subset of markers of selected points in the corresponding callback function?

@fkromer This notebook https://plot.ly/~empet/14975 was posted one year ago. I hope it is what you are looking for.

@empet That’s almost what I’m looking for. In my case I have only blue markers which are very dense. Therefor I’d like to change the selected one to another color with a high contrast to blue, e.g. red. I’m that far right now that the color changes from blue to yellow…

I’ve been looking for this for a while too and I’ve finally found it. It is rather simple and logic:
Use the field “selected_marker_color” when creating your scatter !

        trace = go.Scattergl(
            x = x,
            y = y,
                size=10, )