简体   繁体   中英

how to plot dotted / dashed lines using rgl

I'm trying to plot some 3d shapes using rgl, but I want to connect my points using dashed/dotted lines. How can I do that? Currently I have

require(rgl)

p1 <- c(0,0,0)
p2 <- c(1,0,0)
p3 <- c(1,1,0)
p4 <- c(0,1,0)
p5 <- c(0.5,0.5,0.5)

mat <- cbind(p1,p2,p3,p4,p1,p5,p2,p5,p3,p5,p4)
x <- as.numeric(mat[1,])
y <- as.numeric(mat[2,])
z <- as.numeric(mat[3,])

plot3d(x,y,z,type="l",lwd=2,lty=3,box=FALSE,axes=FALSE,xlab="",ylab="",zlab="")

So lwd works but lty doesn't. I've tried lty="dashed" as well, but to no avail.

I essentially want to plot 3d shapes that I can

  1. Easily rotate around / zoom (like what rgl gives)
  2. Export to a vector graphics format (like rgl.postscript)
  3. Specify line type and color

If there is another package that can achieve that, please share too. Thanks.

I think the best you can do with the rgl package is vertices as dots:

vertices <- c(t(cbind(x,y,z,1)))
indices <- seq_along(x)
dot3d( qmesh3d(vertices,indices) )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM