Setting opacity for unselected points outside the marker

When I select a point in a scatter plot I want all the other unselected points to have a low opacity but without showing the density effect (i.e. non accumulative)

In a normal plot setting the opacity outside the marker achieves this but unselected doesn’t have an opacity attribute.

Is there any other way?


Hi @sabri, welcome to the forum! I think what you want to decrease is not the opacity (which will let the other markers show through it), but the saturation of the color (as in HSV colors). You can pass plotly colors as hsv strings (eg 'hsv(0,100%,100%)') so you could just decrease the saturation of non-selected points.

@sabri See a previous discussion on this forum and a link to a notebook on setting color of selected points and opacity of the non-selected ones.

Thanks Emmanuelle, but hsv in my case is not different from rgb.
This is basically what I am trying to achieve:

I’ve done this by having two plots:

  1. a plot of the unselected points with opacity 0.1 (defined outside the marker)

  2. another plot with selected points drawn on top to avoid overlapping

It is not efficient and a bit slower but that is what I can manage

This is what happens when I use unselected.marker.opacity=0.1:

The problem with hsv or rgb is that the selectedpoints are sometimes buried under the unselected ones and can sometimes be barely seen

I am using the plots in Dash btw.