I'm doing a 3D graph, I did prepare the data to have levels of alerts from 1-5. But not all the measurements have all the alert levels.for example in this graph I don't have level 3 and it should be 1 2 4.
How can I link the alert level to a specific color so I can apply it for all the variables. the following is the code I used:
x <- mile$Locn
y <- mile$Twist3m
z <- mile$TwSeverity
axx <- list(
   title = "Location (mile)"
 )
axy <- list(
   title = "Twist3m"
 )
 axz <- list(
   title = "TwSeverity" , nticks= 5,
   range = c(1,5)
 )
Twfig <- plot_ly(mile, x = ~x,
                 y = ~y, 
                 z = ~TwSeverity,
                 type = 'scatter3d', 
                 mode = 'lines+markers', 
                 color = ~TwSeverity,
                 colors = c("green", "yellow", "coral", "pink", "blue"))%>%
   layout(title = 'Twist3m fault')
Twfig <- Twfig %>% layout(scene = list(xaxis=axx,yaxis=axy,zaxis=axz))
Twfig
Linking each level to a specific color

 
    