Black Lives Matter. Please consider donating to Black Girls Code today.

I can't 3d scatter coloring by Z axis, where is wrong?

I would like to draw 3d scatter coloring by Z axis.
But my code did not work.
where is wrong?

・Code

Values<- data.frame(XVal=XValues, YVal=YValues ,ZVal=ZValues)

p = plot_ly(Values,
x = Values[,1],
y = Values[,2],
z = Values[,3],
marker = list(color = Values[,3],
showscale = TRUE,
size = plotpointsize,
cauto = IsColorAuto,
cmin = ColorMinValue,
cmax = ColorMaxValue)) %>%
add_markers() %>%
layout(scene = list(xaxis = list(title = names(Values)[1]),
yaxis = list(title = names(Values)[2]),
zaxis = list(title = names(Values)[3]))) ;

・Result

I expected the bigger z axis value ,the more Redder points.

Thank you in your advance