plot_change_basis: plot_change_basis

View source: R/plot_change_basis.R

plot_change_basisR Documentation

plot_change_basis

Description

Plot a change of basis from B1 to B2

Usage

plot_change_basis(B1, B2, plot_standard_basis = FALSE)

Arguments

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

Value

An animation created by gganimate.

Examples


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")



jtipton25/dasc2594 documentation built on Oct. 7, 2022, 3:46 p.m.