在R中使用'scatterplot3d'绘制3d线图。是否有一种方法可以谨慎显示颜色,而不是默认将它们混合在一起?
我在文档中到处都看过,但是找不到任何能够谨慎显示颜色的东西(即一个月=数据框中指定的颜色)。这是我目前所拥有的:
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 = " ")
))