💸 Reduce costs by consolidating proprietary analytics & reporting software to open-source & Dash.
Challenge us to replace your analytics with Dash and reduce costs.

Easy way to colour a single marker in scatterplot

Hi,

In my scatterplot I would like to give a single dot a different colour when I click it. I read in the “Does plotly.js scatter/line graph handle point selection?” topic that it is possible to do this by using restyle, e.g. Plotly.restyle('graph', 'marker.color', [['red', 'green','blue']]), which would give the first marker a red colour, the second green etc. If I have 10000 markers and want to change the colour of 1 of them, does that mean I have to pass a complete array every time? Or is there an easy way to just update the colour of e.g. marker 8750 to ‘blue’?

Thanks,
Sander

At the moment, yes, Plotly,restyle can only be used to restyle whole traces.