Is there an alternative to 'abline' for 3D scatterplot? I'm using 'scatterplot3d' package.
The blue line in the image is what I want to do. If I add a 'surface', then it will block the original plot.
像这样的东西?
th <- seq(0,8*pi,len=100)
r <- seq(0,1,len=100)
x <- r*cos(th)
y <- r*sin(th)
z <- 10*r
library(scatterplot3d)
plt <- scatterplot3d(x,y,z, type="l")
plt$points3d(x=c(-1,1,1,-1,-1), y=c(1,1,-1,-1,1),z=rep(5,5), type="l", col="blue", lwd=2)
基本思想是捕获返回的对象sactterplot3d(...)
。这是一个列表,其中一个元素是一个函数,points3d(...)
它可以将点(或带有 的线type="l"
)添加到现有绘图中。