Description Usage Arguments Value Examples
View source: R/plot_decomposition.R
This function produces plots illustrating the transformation of
a pair of linearly independent two-dimensional vectors into an orthogonal
basis (the Q
of the QR
decomposition). The algorithm, which can be found
in any linear algebra textbook, scales the first vector to unit length, then
extracts the component of the second vector orthogonal to the first and
normalizes it. The plots are based on those found on pp. 218-219 of Otto
Bretscher's Linear Algebra with Applications (5th ed.).
1 2 3 4 5 6 7 8 | plot_decomposition(
m,
color_par = "blue",
color_perp = "red",
color_text = "red4",
output = "plot",
fix_coords = FALSE
)
|
m |
A 2 x 2 numeric matrix of full rank, one whose columns provide a
valid basis for the two-dimensional plane. If |
color_par |
Color for the second vector's parallel component. |
color_perp |
Color for the second vector's orthogonal component. |
color_text |
Color for the text of the equations. |
output |
Output mode. If "plot", a single |
fix_coords |
Logical determining whether to draw the plots with fixed aspect ratio. Defaults to FALSE. |
If output
is "plot", a multiplot featuring the six decomposition plots;
otherwise a list containing them.
1 2 3 4 5 | plot_decomposition(square(1, 4, 7, 2))
# With custom colors
plot_decomposition(square(1:4), color_par = "green", color_perp = "orange")
# Already orthogonal vectors: only scaling necessary
plot_decomposition(square(30, 20, 2, -3))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.