Scattermapbox lasso/rectangle transparency affecting all traces and not updating

Hi,
I have been looking for a solution to this in the doc/online without success. I have a dash app with scattermapbox and multiple traces. When using the lasso or rectangle, all the markers get transparent regardless if they are in the lasso area or not. The map needs a full refresh (it recomputes all the markers) to have a regular transparency except for one trace with the highest index that stays transparent.
I have not set this transparency option and I would like to avoid it happening all together. Is it possible?
Thanks in advance

hi @boorhin
I don’t think that’s possible. But can you share you example code please?

One possible solution I have yet to explore is setting the redraw parameter to True. This should make the plot fully redrawn when the lasso or rectangle selection is made.

Hi, I am afraid the code is a bit too large to be shared. I will try to make a simple working example in a notebook.

Sorry, I have been looking around and where do I specify redraw=True, I cannot find it in the doc

hey @boorhin
I was trying to use similar functionality on this page with your code, but I wasn’t able to solve it yet. Let me try another way and get back to you if I find a solution.

Here is an example that reproduces the problem.
It doesn’t come from stacking Scattermapbox only but Scatter and Scattermapbox.
Because I have to have a scale bar associated with the density map I produce as one of the layer, I can only use Scatter. That’s how it looks

import plotly.graph_objects as go
import numpy as np
fig= go.Figure()
fig.add_trace(go.Scatter(x=[None], y=[None],marker=go.scatter.Marker(
                        colorbar=dict( 
                            title= dict( 
                                text="copepodid/m²", #r'$copepodid.m^{-2}.day^{-1}$',
                                side='right'
                                ), 
                            orientation='v', 
                            
                            ),
                        cmax=1,
                        cmin=0,
                        showscale=True,
                        ),
                    name='only_scale',
                    showlegend=False),)
fig.add_trace(go.Scattermapbox(lat=[0,.001,.002,.003],
                                lon=[0,0,0,0],
                               marker=dict(color='#e9ecef',size=np.linspace(200,1000,4),
                                           sizemode='area',
                                          sizeref=10),
                               name="A"
                                
                              ))
fig.add_trace(go.Scattermapbox(lat=[0,.001,.002,.003],
                               lon=[.01,.01,.01,.01],
                               marker=dict(color='#00ccff',size=np.linspace(200,1000,4),
                                           sizemode='area',
                                          sizeref=10),
                                name="B"
                              ))
fig.update_layout(
                height=512,
                hovermode='closest',
                showlegend=False,              
                mapbox=dict(
                    zoom=12                    ,
                    style="carto-positron",
                    ),)
fig.show()