## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  cache = FALSE,
  eval = FALSE,
  rmarkdown.html_vignette.check_title = FALSE
)

## ----setup--------------------------------------------------------------------
# library(tourr)

## ----anim1--------------------------------------------------------------------
# animate(flea[,1:6])

## ----anim2--------------------------------------------------------------------
# animate(flea[,1:6],
#         tour_path = grand_tour(),
#         display = display_xy()
#         )

## ----anim3--------------------------------------------------------------------
# animate(flea[,1:6],
#         tour_path = guided_tour(holes()),
#         display = display_xy())

## ----anim4--------------------------------------------------------------------
# animate(flea[,1:6],
#         tour_path = guided_tour(holes()),
#         display = display_xy(col = flea$species))

## ----anim5--------------------------------------------------------------------
# # defining the color palette
# clrs <- c("#486030", "#c03018", "#f0a800")
# # mapping the species vector onto a color vector
# flea_col <- clrs[as.numeric(flea$species)]
# # the color vector specifies the color for each point
# # and gets passed into the display function
# animate(flea[,1:6],
#         tour_path = guided_tour(holes()),
#         display = display_xy(col = flea_col))

## ----anim6--------------------------------------------------------------------
# animate(flea[,1:6],
#         tour_path = grand_tour(d = 1),
#         display = display_dist()
#         )

## ----anim7--------------------------------------------------------------------
# animate_dist(flea[,1:6])

## ----anim8--------------------------------------------------------------------
# t1 <- save_history(flea[,1:6], max = 3)
# animate(flea[,1:6], planned_tour(t1))

