Color Scaling for data with minute differences

I have a data which has very minute differences between each of them, i want to show the difference in scaling for that, i am using the below code for

fig = px.scatter_mapbox(df, lat="Lat", lon="Long",     color="data",
                  color_continuous_scale=px.colors.sequential.Viridis, size_max=15, zoom=5,opacity=0.5)

the data column has the values such as this 14.27774 , 14.27654, 14.27456 somehow the scaling does not show any massive difference. If i check for unique data in that dataframe there are close to 120 of them. So is there a way to customise the scaling?

Hi @rasika, px uses the min and max of your data to map the colorscale to data values. It’s possible that you have some outliers values which flatten the contrast (you can check this by printing df["data"].min() and max). You can use the range_color argument of px.scatter_mapbox to customize the bounds of the colorscale, in order to stretch the contrast, for example range_color = [14.27, 14.28], or if you want to define the bounds programatically, you can compute the quantiles of the data with scipy.stats.scoreatpercentile and take for example percentile 5 and 95 to eliminate outliers.

Thanks for the reply, do you have any example that uses scipy

There is an example in the docstring of scipy.stats.scoreatpercentile, the output is a value which you can pass to range_color.