Hoverinfo is not showing for each trace

Hi,

I would like to see the hoverinfo of each trace (scatter, scattetrt and contour) but all I see is the hoverinfo of the “contour” trace which is the last I have in my kriging_plot function.

def kriging_plot(lon, lat, conductivite ,grid_x,grid_y,value_interp):

calculées

scatter = go.Scatter(
    x=lon,
    y=lat,
    mode='markers',
    marker=dict(size=8, color=ct_vario, colorscale='viridis',cmin=0, cmax=3.5,showscale=True, line=dict(
        color='black',  
        width=1 )), 
    hovertext= conductivite,  
    hoverinfo="text+name",  
    name='Points LGV',
    
)

#  TRT 
scattetrt = go.Scatter(
    x=trt['X_L93'],  #
    y=trt['Y_L93'], 
    mode='markers',
    text=trt['CONDUCTIVITE_THERMIQUE'],  
    hoverinfo='text+name', 
    marker=dict(size=8,symbol='square', color=trt['CONDUCTIVITE_THERMIQUE'], colorscale='viridis', cmin=0, cmax=3.5,showscale=False, line=dict(
        color='black',  # Couleur du contour (noir dans cet exemple)
        width=1 )),
    name='Données TRT' 
)

# interpolées
contour = go.Contour(
    x=grid_x,
    y=grid_y,
    z=value_interp,
     colorscale='viridis',showscale=False,
    ncontours=50,
    hovertext=value_interp,
    hoverinfo="text+name", 
    name='Interpolation',
        contours=dict(
    start=0,  
    end=3.5,  
    size=0.05
))


# Création de la figure en utilisant les deux traces
fig = go.Figure(data=[scatter,scattetrt,contour])


# taille de la figure
fig.update_layout(hovermode="closest",
    title='Interpolation',
    xaxis_title='Longitude',
    yaxis_title='Latitude',
    width=1000,  # Largeur en pixels
    height=800  # Hauteur en pixels
)

# Affichez la figure
fig.show()

Help T_T
When I would to see the hoverinfo of each trace not just one trace.

Thank you

… OUpsy I know why I changed the order

# Création de la figure en utilisant les deux traces
fig = go.Figure(data=[contour,scatter,scattetrt])

Now it’s okay ! :sweat_smile:

1 Like