Title: Animated Biplots
Version: 1.0.3
Description: Create animated biplots that enables dynamic visualisation of temporal or sequential changes in multivariate data by animating a single biplot across the levels of a time variable. It builds on objects from the 'biplotEZ' package, Lubbe S, le Roux N, Nienkemper-Swanepoel J, Ganey R, Buys R, Adams Z, Manefeldt P (2024) <doi:10.32614/CRAN.package.biplotEZ>, allowing users to create animated biplots that reveal how both samples and variables evolve over time.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
VignetteBuilder: knitr
Depends: R (≥ 4.1.0)
Imports: dplyr, biplotEZ, gganimate, ggplot2, GPAbin
Suggests: testthat, rmarkdown, knitr, tibble, scales
Config/Needs/website: rmarkdown
NeedsCompilation: no
Packaged: 2025-07-01 15:07:47 UTC; raeesaganey
Author: Raeesa Ganey ORCID iD [aut, cre, cph], Johané Nienkemper-Swanepoel ORCID iD [aut, cph]
Maintainer: Raeesa Ganey <raeesa.ganey@wits.ac.za>
Repository: CRAN
Date/Publication: 2025-07-05 18:50:07 UTC

moveEZ: Animated Biplots

Description

logo

Create animated biplots that enables dynamic visualisation of temporal or sequential changes in multivariate data by animating a single biplot across the levels of a time variable. It builds on objects from the 'biplotEZ' package, Lubbe S, le Roux N, Nienkemper-Swanepoel J, Ganey R, Buys R, Adams Z, Manefeldt P (2024) doi:10.32614/CRAN.package.biplotEZ, allowing users to create animated biplots that reveal how both samples and variables evolve over time.

Author(s)

Maintainer: Raeesa Ganey raeesa.ganey@wits.ac.za (ORCID) [copyright holder]

Authors:


Calibrate axis

Description

Calibrate axis

Usage

.calibrate.axis(
  j,
  Xhat,
  means,
  sd,
  axes.rows,
  ax.which,
  ax.tickvec,
  ax.orthogxvec,
  ax.orthogyvec
)

Arguments

j

j

Xhat

Xhat

means

means

sd

sd

axes.rows

axes.rows

ax.which

ax.which

ax.tickvec

ax.tickvec

ax.orthogxvec

ax.orthogxvec

ax.orthogyvec

ax.orothogyvec

Value

Calibrated axes


Climate studies example dataset

Description

Data extracted from ERA5 hourly data on single levels from 1940 to present

Format

A dataset with 960 observations and 9 variables.

Details

Year

8 years from 1950 to 2020

Month

12 calendar months

Region

10 IPCC climate reference regions

AccPrec

Accumulated precipitation

DailyEva

Daily evaporation

Temp

Mean temperature

SoilMois

Soil moisture

SPI6

6-month standardised precipitation index

wind

Windspeed

Source

DOI: 10.24381/cds.adbb2d47 (Accessed on 11-02-2025)


Climate studies target example dataset

Description

Data extracted from ERA5 hourly data on single levels for 1989

Format

A dataset with 120 observations and 9 variables.

Details

Year

8 years from 1950 to 2020

Month

12 calendar months

Region

10 IPCC climate reference regions

AccPrec

Accumulated precipitation

DailyEva

Daily evaporation

Temp

Mean temperature

SoilMois

Soil moisture

SPI6

6-month standardised precipitation index

wind

Windspeed

Source

DOI: 10.24381/cds.adbb2d47 (Accessed on 11-02-2025)


Provide axes coordinates

Description

Provide axes coordinates

Usage

axes_moveEZ(bp, which.var)

Arguments

bp

Object

which.var

which variable(s) to find coordinates

Value

Axes coordinates


Move plot

Description

Create animated biplot on samples in a biplot

Usage

moveplot(bp, time.var, group.var, move = TRUE, hulls = TRUE, scale.var = 5)

Arguments

bp

biplot object from biplotEZ

time.var

time variable

group.var

group variable

move

whether to animate (TRUE) or facet (FALSE) samples, according to time.var

hulls

whether to display sample points or convex hulls

scale.var

scaling the vectors representing the variables

Value

An animated or a facet of biplots based on the fixed variable frame.

Examples

data(Africa_climate)
bp <- biplotEZ::biplot(Africa_climate, scaled = TRUE) |> biplotEZ::PCA()
bp |> moveplot(time.var = "Year", group.var = "Region", hulls = TRUE, move = FALSE)
bp |> moveplot(time.var = "Year", group.var = "Region", hulls = FALSE, move = FALSE)

if(interactive()) {
bp |> moveplot(time.var = "Year", group.var = "Region", hulls = TRUE, move = TRUE)}

Move plot 2

Description

Create animated biplot on samples and variables in a biplot

Usage

moveplot2(
  bp,
  time.var,
  group.var,
  move = TRUE,
  hulls = TRUE,
  scale.var = 5,
  align.time = NA,
  reflect = NA
)

Arguments

bp

biplot object from biplotEZ

time.var

time variable

group.var

group variable

move

whether to animate (TRUE) or facet (FALSE) samples and variables, according to time.var

hulls

whether to display sample points or convex hulls

scale.var

scaling the vectors representing the variables

align.time

a vector specifying the levels of time.var for which the biplots should be aligned. Only biplots corresponding to these time points will be used to compute the alignment transformation.

reflect

a character vector specifying the axis of reflection to apply at each corresponding time point in align.time. One of FALSE (default), "x" for reflection about the x-axis, "y" for reflection about the y-axis and "xy" for reflection about both axes.

Value

An animated or a facet of biplots based on the dynamic frame.

Examples

data(Africa_climate)
bp <- biplotEZ::biplot(Africa_climate, scaled = TRUE) |> biplotEZ::PCA()

if(interactive()) {
bp |> moveplot2(time.var = "Year", group.var = "Region", hulls = TRUE, move = TRUE)}

Move plot 3

Description

Create animated biplot on samples and variables in a biplot with a given target

Usage

moveplot3(
  bp,
  time.var,
  group.var,
  move = TRUE,
  hulls = TRUE,
  scale.var = 5,
  target = NULL
)

Arguments

bp

biplot object from biplotEZ

time.var

time variable

group.var

group variable

move

whether to animate (TRUE) or facet (FALSE) samples and variables, according to time.var

hulls

whether to display sample points or convex hulls

scale.var

scaling the vectors representing the variables

target

Target data set to which all biplots should be matched consisting of the the same dimensions. If not specified, the centroid of all available biplot sample coordinates from time.var will be used. Default NULL.

Value

An animated or a facet of biplots based on the dynamic frame.

Examples

data(Africa_climate)
data(Africa_climate_target)
bp <- biplotEZ::biplot(Africa_climate, scaled = TRUE) |> biplotEZ::PCA()
bp |> moveplot3(time.var = "Year", group.var = "Region", hulls = TRUE,
move = FALSE, target = NULL)

if(interactive()) {
bp |> moveplot3(time.var = "Year", group.var = "Region", hulls = TRUE,
move = TRUE, target = NULL)}
bp |> moveplot3(time.var = "Year", group.var = "Region", hulls = TRUE,
move = FALSE, target = Africa_climate_target)

Reflect the biplot about a chosen axis

Description

This function provides the user with an option to reflect the biplot horizontally, vertically or diagonally.

Usage

reflect_biplot(bp, reflect.axis = c("FALSE", "x", "y", "xy"))

Arguments

bp

an object of class biplot

reflect.axis

a character string indicating which axis about to reflect. One of FALSE (default), "x" for reflection about the x-axis, "y" for reflection about the y-axis and "xy" for reflection about both axes.

Value

An object of class biplot