我试图绘制下面数据的多元回归模型的结果
spp.nms[, 2] variable value
1 -0.28547969 Plot 1.00000000
2 0.34730550 Plot 2.00000000
3 0.05984583 Plot 3.00000000
4 0.20147975 Plot 4.00000000
5 0.31828558 Plot 5.00000000
6 -0.28547969 Log 1.00000000
7 0.34730550 Log 1.00000000
8 0.05984583 Log 1.00000000
9 0.20147975 Log 1.00000000
10 0.31828558 Log 1.00000000
11 0.24869223 Log 0.00000000
12 -0.35147868 Log 0.00000000
13 -0.44278265 Log 0.00000000
14 -0.28047515 Log 0.00000000
15 0.32283950 Log 0.00000000
16 -0.28547969 Soil1 -7.43637019
17 0.34730550 Soil1 -2.55011049
18 0.05984583 Soil1 -4.70072757
19 0.20147975 Soil1 1.04846090
20 0.31828558 Soil1 0.60488995
21 -0.50656941 Soil2 1.15166319
22 0.11406246 Soil2 1.29153863
23 0.24252115 Soil2 -1.24299685
24 0.39305738 Soil2 -0.71739651
25 0.49439872 Soil2 NA
26 -0.50656941 Soil3 -2.04573421
27 0.11406246 Soil3 -1.22057237
28 0.24252115 Soil3 0.09168261
29 0.39305738 Soil3 1.14051538
30 0.49439872 Soil3 NA
31 -0.28547969 Disttovil 3.89100000
32 0.34730550 Disttovil 7.20900000
33 0.05984583 Disttovil 7.57900000
34 0.20147975 Disttovil 12.25300000
35 0.31828558 Disttovil 15.39600000
36 -0.28547969 Disttostrm 1.82658621
37 0.34730550 Disttostrm 0.95400297
38 0.05984583 Disttostrm 2.27278375
39 0.20147975 Disttostrm 1.86702254
40 0.31828558 Disttostrm 2.23311494
41 -0.28547969 LAI 4.31000000
42 0.34730550 LAI 3.49000000
43 0.05984583 LAI 2.60000000
44 0.20147975 LAI 3.98000000
45 0.31828558 LAI 3.66000000
这是我为了获得所有回归的图而编写的脚本
require(reshape2)
data_trial<-melt(data_nms2, id.vars = "spp.nms[, 2]")
ggplot(data_trial) +
geom_point(aes(value,spp.nms[, 2], color=variable)) +
geom_jitter(aes(value,spp.nms[, 2], colour=variable),
method=lm, se=FALSE) +
facet_wrap(~variable, scales="free_x") +
labs(x = "Variables",
y = "Species Composition along NMS axis2")
但是我收到了这个错误
错误:美学必须是长度1或与数据相同:x,y,颜色