我是否可以从另一个视图中调用视图:
myColors=c("red","green","blue","orange","pink","purple")
df<-setNames(data.frame(matrix(ncol = 3, nrow = 0)), c("Person","yearsExp", "yearsStudy"))
df[nrow(df) + 1,] = c(1,0,0)
df[nrow(df) + 1,] = c(2,0,3)
df[nrow(df) + 1,] = c(3,3,0)
df[nrow(df) + 1,] = c(4,3,3)
plot(df$yearsExp,df$yearsStudy,xlab=xlab,ylab=ylab,main=title,pch=pchvector,col=colvector,type="n",xlim=c(0,3),ylim=c(0,3))
text(df$yearsExp,df$yearsStudy,labels=df$Person)
# will draw
lines(c(1.9,1.9), c(2.0,2.4), pch=16, col=myColors[3],type="l")
lines(c(1.3,1.2), c(1.8,1.1), pch=16, col=myColors[2],type="l")
lines(c(1.7,1.1), c(1.3,1.9), pch=16, col=myColors[1],type="l")
# wont draw
lines(c(0.0,0.0), c(3.0,3.0), pch=16, col=myColors[6],type="l")
lines(c(0.1,0.1), c(1.3,1.3), pch=16, col=myColors[5],type="l")
lines(c(1.3,1.3),c(0.1,0.1), pch=16, col=myColors[4],type="l")
效果很好,但我不知道这是否是使用Django视图的好方法。
感谢您的回答。