plot_vector_2d: Function plots 2d arrowed vectors

View source: R/plot_vector_2d.R

plot_vector_2dR Documentation

Function plots 2d arrowed vectors

Description

Function plots one or more arrowed vectors across a 2d plotting space. Options are provided to add an x-y axis and a grid. Either the from_to or to arguments may be specified to populate the plot.

Usage

plot_vector_2d(
  from_to = NULL,
  to = NULL,
  vector_labels = NULL,
  vector_colors = NULL,
  vector_widths = NULL,
  vector_linetypes = NULL,
  draw_axis = TRUE,
  axis_color = "black",
  grid_color = "lightgreen",
  lines_00_color = "darkgreen",
  x_breaks = c(-5, 5, 1),
  y_breaks = c(-5, 5, 1),
  x_title = "X",
  y_title = "Y",
  char_mag = 1.5
)

Arguments

from_to

A n x 4 numeric matrix that defines n vectors where the first two columns define the x/y "from" point and the last two columns define the x/y "to" point of each vector.

to

An n x 2 numeric matrix that defines n vectors where the x/y "from" point is assumed to be at the origin (0,0) and the two columns of to define the x/y "to" point for each vector.

vector_labels

A vector of strings with the same length as from_to or to that defines a label for each vector.

vector_colors

A vector of strings with the same length as to or from_to that defines a color for each vector.

vector_widths

A numeric vector with the same length as to or from_to that defines a width for each vector.

vector_linetypes

A vector of strings with the same length as to or from_to that defines a line type for each vector. Acceptable values are "blank", "solid", "dashed", "dotted", "dotdash", "longdash", "twodash".

draw_axis

A logical which if TRUE, draws the numeric x/y axis'.

axis_color

A string that defines the axis color.

grid_color

A string that defines the grid color.

lines_00_color

A string that defines the color for vertical/horizontal lines from (0,0).

x_breaks

A numeric three element vector of upper, lower, and interval for exact x axis tic locations.

y_breaks

A numeric three element vector of upper, lower, and interval for exact y axis tic locations.

x_title

A string that sets the x axis title.

y_title

A string that sets the y axis title.

char_mag

A numeric that defines the magnification of the vector's label size.


deandevl/RmatrixPkg documentation built on March 11, 2023, 2:39 a.m.