Learn R Programming

svgViewR (version 1.4.3)

svg.arrows: Write arrows to Viewer

Description

Draws static and animated arrow(s) in Viewer.

Usage

svg.arrows(x, y=NULL, name="arrow", col="black", z.index=0, layer="", 
           label="", lwd=1, len='auto', angle=0.4, opacity=1, file=NULL)

Value

NULL

Arguments

x

For a single static arrow, a 2x3 matrix in which the rows are the start and end point in 3D. For a single animated arrow, a 2x3xi array in which the first two dimensions specify the start and end point of the arrow and i is the number of animation iterations. For multiple static arrows, a list of length n, each element being a 2x3 matrix, in which n is the number of arrows. For multiple animated arrows, a list of length n, each element being a 2x3xi array indicating the start and end points of each arrow over i iterations.

y

If x is a vector, the coordinates on the y-axis.

name

The name of the drawn object.

col

The stroke color of the arrow.

z.index

A number indicating the relative order in which the object will be drawn in the viewer. Higher numbers correspond to closer to the front or top.

layer

A text string indicating the layer in which the object belongs (not yet fully implemented).

label

A label to be added to the object in SVG tag.

lwd

The thickness of the arrow.

len

The length of the arrowhead.

angle

The angle (in radians) between the arrowhead lines and the main shaft of the arrow.

opacity

The opacity of the arrow.

file

File path (having the extenstion ".html") to add lines to a current Viewer file. By default (i.e. NULL) lines are added to the Viewer opened by svg.new.

Author

Aaron Olsen

Details

This function accepts many different input types for x to plot four different arrow types: a single static arrow, multiple static arrows, a single animated arrow, and multiple animated arrows. For worked examples, please see Plotting arrows with svgViewR. The first of these worked examples is included in the examples below.

See Also

svg.new, svg.lines

Examples

Run this code
if (FALSE) {
## Create arrow
arrow <- rbind(rep(0,3), rep(1,3))

# Open a connection to .html file
svg.new(file='plot_static_arrow.html')

# Add arrow
svg.arrows(arrow)

# Add a coordinate axis planes around the arrow
svg_frame <- svg.frame(arrow)

# Close the file connection
svg.close()
}

Run the code above in your browser using DataLab