【发布时间】:2020-02-11 23:11:40
【问题描述】:
我需要一起分析 3 组数据。我正在使用scatterplot3d 来分析这些数据。
我需要为 x 轴上的每个值赋予不同的颜色。
The value on the x axis is Terreno (Soil) and goes from -4 to +6.
The value on the y axis is P.I.
The value on the z axis is PERSE.TOTALI (Total lost).
我能够创建 3D 散点图,但无法为 x 轴上的每个值指定颜色,我应该如何进行? 谢谢
#here are the data I'm trying to plot
dput(head(dati3,25))
structure(list(Terreno = c(-4L, -4L, -4L, 5L, -4L, 3L, 6L, -4L,
5L, -4L, 3L, -4L, 5L, 3L, 5L, -4L, -4L, 3L, -4L, 3L, 3L, -4L,
-4L, -4L, 3L), P.I. = c(1, 0, 1, 2, 0, 2, 2, 2, 2, 1.5, 2, 1.5,
1, 2, 1.5, 1, 0, 0, -0.5, 2, 1, 1, 1, 1, 1), PERSE.TOTALI = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0)), row.names = c(NA, 25L), class = "data.frame")
#this is the code I'm using for the plot
scatterplot3d(Terreno, P.I., PERSE.TOTALI,pch=16,highlight.3d = T, type="h")
我应该在代码中插入什么以使每个 x 值都以不同的颜色绘制? 谢谢!
【问题讨论】:
标签: r colors scatter-plot