A question about (Scatter with a Color Dimension)

maybe my question isnā€™t good .but I thought and couldnā€™t figure out. here is code (this code is from Scatter tutorial in plotly):

import plotly.graph_objs as go
import plotly.plotly as py

import numpy as np

trace1 = go.Scatter(
y = np.random.randn(500),
mode=ā€˜markersā€™,
marker=dict(
size=ā€˜16ā€™,
color = np.random.randn(500), #set color equal to a variable
colorscale=ā€˜Viridisā€™,
showscale=True
)
)
data = [trace1]

py.iplot(data, filename=ā€˜scatter-plot-with-colorscaleā€™)

in here any relationship between color and variables?

we set ā€œshowscale=Trueā€ and my question is why markers with lowcolor in scale are above axis?

for example yellow markers have 2variables but we see some of them have -1.5 var in scatter,and they are below axis

Hey @arminoldboy,

The trace given as example, illustrates how to color the dots according to the numerical values in color. It works as follows:
The values in color, of min value a, and max value b, are mapped to [0,1] via v in [a,b]ā€“>(v -a)/(b-a) in [0,1].
The colorscale in Plotly is a list of lists as in this example:

pl_colorscale=[[0.0, 'rgb(46, 107, 142)'],
[0.1, 'rgb(41, 121, 142)'],
[0.2, 'rgb(36, 134, 141)'],
[0.3, 'rgb(31, 147, 139)'],
[0.4, 'rgb(30, 160, 135)'],
[0.5, 'rgb(40, 174, 127)'],
[0.6, 'rgb(59, 186, 117)'],
[0.7, 'rgb(85, 198, 102)'],
[0.8, 'rgb(116, 208, 84)'],
[0.9, 'rgb(151, 216, 62)'],
[1.0, 'rgb(189, 222, 38)']]

Now to each point of coordinates (X,Y) corresponds a value in color, that is mapped to a value in [0,1] by the above defined function, and to this normalized value corresponds, via linear interpolation, a color in the colorscale. Hence the color does not point out the position of the point with respect to x and yaxis.