Hi
Does anyone know how to put a colour bar on a 3D plot, using Mesh 3D, based on the colour intensity of the facecolour asthetic?
Here is my code
p1 <- plot_ly(
x = points[, 1], y = points[, 2], z = points[, 3],
i = faces[, 1]-1, j = faces[, 2]-1, k = faces[, 3]-1,
type = “mesh3d”,
facecolor = face$colour,
)
where facecolour is the colour of each triangle based on something measured at each vertice (but not the actual x,y or z vertice itself)
face$colour[zmean<= 0.5] <- "#800026"
face$colour[zmean> 0.5 & zmean<=0.6] <- "#bd0026"
face$colour[zmean> 0.6 & zmean<=0.7] <- "#e31a1c"
face$colour[zmean> 0.7 & zmean<=0.8] <- "#fc4e2a"
face$colour[zmean> 0.8 & zmean<=0.9] <- "#fd8d3c"
face$colour[zmean> 0.9 & zmean<=1] <- "#feb24c"
face$colour[zmean> 1 & zmean<=1.1] <- "#ffffe5"
face$colour[zmean> 1.1 & zmean<=1.2] <- "#d9f0a3"
face$colour[zmean> 1.2 & zmean<=1.3] <- "#addd8e"
face$colour[zmean> 1.3 & zmean<=1.4] <- "#78c679"
face$colour[zmean> 1.4 & zmean<=1.5] <- "#41ab5d"
face$colour[zmean> 1.5 & zmean<=1.6] <- "#238443"
face$colour[zmean> 1.6 & zmean<=1.8] <- "#41b6c4"
face$colour[zmean> 1.8 & zmean<=2] <- "#41b6c4"
face$colour[zmean> 2 & zmean<=2.5] <- "#225ea8"
face$colour[zmean> 2.5] <- “#081d58”
heres the plot if that helps
https://plot.ly/~neilsrini1/5/trace-0-vs-col4/?share_key=JJL6iqxYvxSEOkYwOYtFNn
thanks