Python will build a color bar associated with the maximum and minimum number of values

This is the code I'm trying to show the speed of the car for each point.

import plotly.plotly as py
from plotly.graph_objs import *

mapbox_access_token = 'MAPBOX API KEY'


data = Data([
    Scattermapbox(
        lat=dataframe_monday_morning['latitude'],
        lon=dataframe_monday_morning['longitude'],
        mode='markers',
        marker=Marker(
            size=5,
            color =dataframe_monday_morning['speed'],
            colorscale= 'YlOrRd',

            #opacity=0.3,
            symbol = 'circle',

        ),

    )
])
layout = Layout(
    autosize=True,
    hovermode='closest',
    width=1300,
        margin=go.Margin(
        l=0,
        r=0,
        b=0,
        t=0
        ),
    height=700,
    mapbox=dict(
        accesstoken=mapbox_access_token,
        bearing=0,#
        center=dict(
            lat=-36.7526,
            lon=174.7274
        ),
        pitch=0,
        zoom=16.2,
        style='dark',


    ),
)

fig = dict(data=data, layout=layout)
py.iplot(fig, filename='Multiple Mapbox')

but when i try

color =dataframe_monday_morning['speed']

the code selects the current min and max speed data and then gives me a graph. In the data, some gaps in speed are very large, so I would like to create a color scale between my speed value. (for example, if you choose a top speed of 200 km / h, the other 30 km / h and 90 km / h look the same color, but usually really differ in speed).

enter image description here

My question is, how can I create a scale for choosing colors for speed?

EDIT:

This is an example of the data that I edited.

13  1.464301e+10    2015-11-15 18:28:50 191 10051   76  -36.817540  174.750526      
14  1.464298e+10    2015-11-15 18:27:20 209 10051   48  -36.806104  174.759209      
15  1.464180e+10    2015-11-15 17:41:27 171 10051   0   -36.718553  174.713503  
16  1.464186e+10    2015-11-15 17:43:44 172 10051   25  -36.720747  174.713897  
17  1.464238e+10    2015-11-15 18:05:36 137 10051   5   -36.753691  174.728945  
18  1.464199e+10    2015-11-15 17:49:22 170 10051   0   -36.728252  174.715084  
19  1.464279e+10    2015-11-15 18:20:41 153 10051   20  -36.787389  174.752337  
20  1.464229e+10    2015-11-15 18:01:47 146 10051   16  -36.749369  174.724865  
21  1.464298e+10    2015-11-15 18:27:39 216 10051   51  -36.807940  174.757603  
22  1.464254e+10    2015-11-15 18:11:35 162 10051   36  -36.765195  174.739728  
23  1.464301e+10    2015-11-15 18:28:37 197 10051   66  -36.815369  174.751177  
+4
source share
1 answer

100%, ,

showscale=True,
cmax=200,
cmin=0

Marker, max min .

enter image description here

+2

Source: https://habr.com/ru/post/1676623/


All Articles