Learn R Programming

ferrn (version 0.3.0)

plot_projection: Plot the projection from the optimisation data collected from projection pursuit

Description

Plot the projection from the optimisation data collected from projection pursuit

Usage

plot_projection(
  dt,
  data,
  id = NULL,
  cols = NULL,
  label = TRUE,
  animate_along = NULL,
  keep = 0.2
)

compute_projection(dt, data, id = NULL, cols = NULL)

Value

a ggplot object

Arguments

dt

a data object collected by the projection pursuit guided tour optimisation in tourr

data

the original data

id

the grouping variable

cols

additional columns to include in the plot

label

logical, whether to label each panel by its index value

animate_along

the variable to animate along

keep

numeric, the proportion of the data to keep for animation (default is 0.2). Only used when `animate_along` is not NULL

Examples

Run this code
library(dplyr)
holes_2d_jellyfish |>
  filter(loop == 1, tries %in% seq(1, 50, 5)) |>
  plot_projection(data = boa6)
if (FALSE) {
library(dplyr)
# track the first jellyfish (loop == 1)
holes_2d_jellyfish |>
  filter(loop == 1) |>
  plot_projection(data = boa6, animate_along = tries, id = loop)
}

Run the code above in your browser using DataLab