我有一个数据集,试图将其绘制成不同的组。目前,我的代码是
par(mfrow=c(1,1))
plot(Length..mm., P.Weight..g.,col="white",xlab="Primary Spine Length", ylab="Primary Spine Weight")
#Auckland
points(Length..mm.[498:606],P.Weight..g. 498:606],col="darkorange",pch=3,cex=.6)
#White Island
points(Length..mm.[611:719],P.Weight..g.[611:719],col="firebrick",pch=19,cex=.6)
#Wellington
points(Total.Length[228:380],Postoral.Arm.1[228:380],col="darkcyan",pch=1,cex=.6)
#Picton
points(Total.Length[385:493],Postoral.Arm.1[385:493],col="purple",pch=2,cex=.6)
#Fiordland
points(Total.Length[115:223],Postoral.Arm.1[115:223],col="limegreen",pch=4,cex=.6)
#Stewart Island
points(Total.Length[2:110],Postoral.Arm.1[2:110],col="midnightblue",pch=5,cex=.6)
我想为每个组/位置添加一个线性模型,并给线涂上颜色。
任何帮助将不胜感激!