Learn R Programming

compositions (version 2.0-2)

arrows3D: arrows in 3D, based on package rgl

Description

adds 3-dimensional arrows to an rgl plot.

Usage

arrows3D(…)
# S3 method for default
arrows3D(x0,x1,…,length=0.25,
                     angle=30,code=2,col="black",
                     lty=NULL,lwd=2,orth=c(1,0.0001,0.0000001),
                     labs=NULL,size=lwd)

Arguments

x0

a matrix or vector giving the starting points of the arrows

x1

a matrix or vector giving the end points of the arrows

additional plotting parameters as described in rgl::rgl.material

length

a number giving the length of the arrowhead

angle

numeric giving the angle of the arrowhead

code

0=no arrowhead,1=arrowhead at x0,2=arrowhead at x1,3=double headed

col

the color of the arrow

lty

Not implemented, here for compatibility reasons with arrows

lwd

line width in pixels

orth

the flat side of the arrow is not unique by x0 and x1. This ambiguity is solved in a way that the arrow seams as wide as possible from the viewing direction orth.

labs

labels to be plotted to the endpoints of the arrows

size

size of the plotting symbol

Value

the 3D plotting coordinates of the tips of the arrows displayed, returned invisibly

Details

The function is called to plot arrows into an rgl plot. The size of the arrow head is given in a absolute way. Therefore it is important to give the right scale for the length, to see the arrow head and that it does not fill the whole window.

See Also

plot3D, rgl::points3d, graphics::plot

Examples

Run this code
# NOT RUN {
x <- cbind(rnorm(10),rnorm(10),rnorm(10))
if(requireNamespace("rgl", quietly = TRUE)) {
  plot3D(x)
  x0 <- x*0
  arrows3D(x0,x)
} ## this function requires package 'rgl'
# }

Run the code above in your browser using DataLab