i think the problem is that a colour legend does not work with mesh 3d.
i asked the plotly team and they were unable to give an answer/didnt know how to solve it.
my work around was the plot the same graph as a scatter 3d and put a colour legend in and then i cut and past the legend out for my final figure.
so i did this just to make my scale
plot_ly(
x = points[, 1], y = points[, 2], z = points[, 3],
marker = list(
autocolorscale = FALSE,
cmax = 2.5,
cmin = 0,
color = vert$colour,
#colorscale = vert$bi,
colorbar = “middle”,
colorscale = list(c(0, “#800026”),
list(0.2, “#bd0026”),
list(0.24, “#e31a1c”),
list(0.28, “#fc4e2a”),
list(0.32, “#fd8d3c”),
list(0.36, “#feb24c”),
list(0.4, “#ffffe5”),
list(0.44, “#d9f0a3”),
list(0.48, “#addd8e”),
list(0.52, “#78c679”),
list(0.56, “#41ab5d”),
list(0.6, “#238443”),
list(0.64, “#41b6c4”),
list(0.8, “#225ea8”),
list(1, “#081d58”)),
line = list(width = 0),
opacity = 0.9,
size = 20,
symbol = “circle”,
showscale=TRUE),
opacity = 0.5,
type=“scatter3d”,
mode= “markers”,
#visable=FALSE
)