Line_mapbox, plot line colors depending on a column dataframe values


I am plotting a gps track on a mapbox with line_mapbox. I would like to plot lines between points with the color representing a speed value. That is the color scale represent the speed value of the resulting vector. However, when plotting the map, the function separates points with different colors in different categories and then plot a different trace for each color, that is for each speed values. As a result I have different traces each one with a specific color and not a unique trace with vectors of different color.
Someone had the same problem? Thanks for your help!

Best, José.

fig = px.line_mapbox(gdf, lat="lat", lon="lng", hover_name="time",
                     hover_data=["speed", "vmg"],
                     color = "colorVal", color_discrete_map=discr_map,
                     zoom=zoomOnWater, center = dcCenter)

Hi @josbenco , you cannot colour a line with values with Plotly as you only have values for points rather than intervals. The only option to my knowledge is to make it a scatter_mapbox, or use a lot of traces like you are doing.

Hi @RenaudLN ! Thanks for your reply! Yes I tried with a lot of traces however, I am developping a dashboard visualizing sport gps tracking, then with a lot of points (more than one thousand). Therefore processing takes a lot of time, so much for production.