View source: R/plot_change_basis.R
plot_change_basis | R Documentation |
Plot a change of basis from B1 to B2
plot_change_basis(B1, B2, plot_standard_basis = FALSE)
B1 |
2 by 2 matrix of the initial basis |
B2 |
2 by 2 matrix of the final basis |
plot_standard_basis |
A logical argument where if TRUE, plot the two transformations, first from B1 to the standard basis I and then from standard basis I to B2 |
An animation created by gganimate
.
library(tidyverse) # create a 2D basis matrix B1 <- matrix(c(1, 1, 0, 2), 2, 2) # create a 2D basis matrix B2 <- matrix(c(1, 2, 2, 1), 2, 2) # create a vector with coordinates with respect to the standard basis x <- c(-1, -2) # plot the transformation of basis, and the intermediate transformation to the standard basis plot_change_basis(B1, B2) + facet_wrap(~ time, labeller = labeller(time = c("1" = "B1", "2" = "B2"))) + geom_segment(aes(x = 0, xend = -1, y = 0, yend = -2), color = "blue") plot_change_basis(B1, B2, plot_standard_basis = TRUE) + facet_wrap(~ time, labeller = labeller(time = c("1" = "B1", "1.5" = "I", "2" = "B2"))) + geom_segment(aes(x = 0, xend = -1, y = 0, yend = -2), color = "blue")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.