display_xy: Display tour path with a scatterplot

Description Usage Arguments Examples

View source: R/display-xy.r

Description

Animate a 2D tour path with a scatterplot.

Usage

1
2
3
4
display_xy(center = TRUE, axes = "center", half_range = NULL,
  col = "black", pch = 20, edges = NULL, origin_line = NULL, ...)

animate_xy(data, tour_path = grand_tour(), ...)

Arguments

center

if TRUE, centers projected data to (0,0). This pins the center of data cloud and make it easier to focus on the changing shape rather than position.

axes

position of the axes: center, bottomleft or off

half_range

half range to use when calculating limits of projected. If not set, defaults to maximum distance from origin to each row of data.

col

color to be plotted. Defaults to "black"

pch

size of the point to be plotted. Defaults to 20.

edges

A two column integer matrix giving indices of ends of lines.

origin_line

row number(s) of data points to draw to the origin. Adopts the color of the point. If used axes = "bottomleft" is suggested.

...

other arguments passed on to animate and display_xy

data

matrix, or data frame containing numeric columns

tour_path

tour path generator, defaults to 2d grand tour

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
animate_xy(flea[, 1:6])
animate(flea[, 1:6], tour_path=grand_tour(), display=display_xy())
animate(flea[, 1:6], tour_path=grand_tour(),
  display=display_xy(axes = "bottomleft"))
animate(flea[, 1:6], tour_path=grand_tour(),
  display=display_xy(half_range = 0.5))
animate_xy(flea[, 1:6], tour_path=little_tour())
animate_xy(flea[, 1:3], tour_path=guided_tour(holes), sphere = TRUE)
animate_xy(flea[, 1:6], center = FALSE)

# The default axes are centered, like a biplot, but there are other options
animate_xy(flea[, 1:6], axes = "bottomleft")
animate_xy(flea[, 1:6], axes = "off")
animate_xy(flea[, 1:6], dependence_tour(c(1, 2, 1, 2, 1, 2)),
  axes = "bottomleft")
require(colorspace)
pal <- rainbow_hcl(length(levels(flea$species)))
col <- pal[as.numeric(flea$species)]
animate_xy(flea[,-7], col=col)

# You can also draw lines
edges <- matrix(c(1:5, 2:6), ncol = 2)
animate(flea[, 1:6], grand_tour(),
  display_xy(axes = "bottomleft", edges = edges))

# Adding lines to the origin
animate_xy(flea[,-7], col=col, axes = "bottomleft",
  origin_line = c(5, 30, 60))

nspyrison/tourr documentation built on Aug. 29, 2019, 2:56 a.m.