[R] adding 3D arrows to 3D plots

Eben J. Gering eben at mail.utexas.edu
Thu Jan 7 05:06:18 CET 2010


Greetings,

I would like to add 3D arrows (i.e. arrow-headed vectors linking X1Y1Z1 to X2,Y2,Z2) to a 3D plot; ideally the sort of plot that can be rotated interactively.  Is this possible using plot3d, or another 3d plotter in R?  
While it is easy to draw segments in plot3d (e.g. below), I haven't figured out how to add arrow heads, or to create 3d arrows from scratch.  

##two headless segments:
library(rgl)
matrix(1:2,2,3)->segment1
matrix(1:3,2,3)->segment2
plot3d(segment2,type="l",col="red",xlim=c(0,3),ylim=c(0,3),zlim=c(0,3))
plot3d(segment1,type="l",add=TRUE,col="blue")


thanks for any assistance,
-Eben J. Gering
Graduate Student, Section of Integrative Biology
The University of Texas at Austin


More information about the R-help mailing list