Plotting 3d line graph using 'scatterplot3d' in R. Is there a way to display the colours discreetly instead of them blending in together by default?
I've looked everywhere in the documentation but couldn't find anything that would allow the colours to be displayed discreetly (i.e. one month = its colour specified in the data frame). Here is what I have at the moment:
months <- c("June", "July", "August", "September")
trees <- c("birch", "birch", "birch", "birch")
height <- c("10", "12", "14", "20")
colour <- c("#7F7F7F", "#E36C09", "#FFFF00", "#E36C09")
forest <- data.frame(trees, months, height, colour)
plot_ly(data = forest, x = ~months, y = ~height, z= ~trees, split = ~trees,
type = 'scatter3d', mode = 'lines',
line = list(color = forest$colour, width = 10)) %>%
layout(
title = "tree height",
scene = list(
xaxis = list(title = " ", dtick = 1),
yaxis = list(title = "height, cm"),
zaxis = list(title = " ")
))