Eben J. Gering wrote:
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")
There isn't any current code to do that in rgl, but if you have a
particular shape of arrow in mind, you could probably draw it with some
combination of functions. The main problem is that I've never seen any
very appealing rotatable 3d arrows. There's a Matlab function to draw
some here:
http://www.mathworks.com/matlabcentral/fileexchange/8396-draw-3d-arrows;
it could probably be translated into rgl if you wanted that.
Duncan Murdoch
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.