Description Usage Arguments Value See Also Examples

This function draws vectors in a 2D plot, in a way that facilitates constructing vector diagrams. It allows vectors to be specified as rows of a matrix, and can draw labels on the vectors.

1 2 |

`X` |
a vector or two-column matrix representing a set of geometric vectors; if a matrix, one vector is drawn for each row |

`origin` |
the origin from which they are drawn, a vector of length 2. |

`lwd` |
line width(s) for the vectors, a constant or vector of length equal to the number of rows of |

`angle` |
the |

`length` |
the |

`labels` |
a logical or a character vector of labels for the vectors. If |

`cex.lab` |
character expansion applied to vector labels. May be a number or numeric vector corresponding to the the
rows of |

`pos.lab` |
label position relative to the label point as in |

`frac.lab` |
location of label point, as a fraction of the distance between |

`...` |
other arguments passed on to graphics functions. |

none

Other vector diagrams: `Proj`

,
`arc`

, `arrows3d`

,
`corner`

, `plot.regvec3d`

,
`pointOnLine`

, `regvec3d`

,
`vectors3d`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
# shows addition of vectors
u <- c(3,1)
v <- c(1,3)
sum <- u+v
xlim <- c(0,5)
ylim <- c(0,5)
# proper geometry requires asp=1
plot( xlim, ylim, type="n", xlab="X", ylab="Y", asp=1)
abline(v=0, h=0, col="gray")
vectors(rbind(u,v,`u+v`=sum), col=c("red", "blue", "purple"), cex.lab=c(2, 2, 2.2))
# show the opposing sides of the parallelogram
vectors(sum, origin=u, col="red", lty=2)
vectors(sum, origin=v, col="blue", lty=2)
# projection of vectors
vectors(Proj(v,u), labels="P(v,u)", lwd=3)
vectors(v, origin=Proj(v,u))
corner(c(0,0), Proj(v,u), v, col="grey")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.