proto_basis: Tour proto for a 2D and 1D basis axes respectively

Description Usage Arguments See Also Examples

View source: R/2_ggproto_visualize.r

Description

Adds basis axes to the animation, the direction and magnitude of contributions of the variables to the projection space inscribed in a unit circle for 2D or rectangle of unit width for 1D.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
proto_basis(
  position = c("left", "center", "right", "bottomleft", "topright", "off"),
  manip_col = "blue",
  line_size = 1,
  text_size = 5
)

proto_basis1d(
  position = c("top1d", "floor1d", "off"),
  manip_col = "blue",
  segment_size = 2,
  text_size = 5
)

Arguments

position

The position, to place the basis axes relative to the centered data. Expects one of c("left", "center", "right", "bottomleft", "topright", "off"), defaults to "left".

manip_col

The color to highlight the manipulation variable with. Not applied if the tour isn't a manual tour. Defaults to "blue".

line_size

(2D bases only) the thickness of the lines used to make the axes and unit circle. Defaults to 1.

text_size

Size of the text label of the variables.

segment_size

(1D bases only) the width thickness of the rectangle bar showing variable magnitude on the axes. Defaults to 2.

See Also

Other ggtour proto: filmstrip(), ggtour(), proto_default(), proto_density(), proto_hex(), proto_highlight(), proto_origin(), proto_point(), proto_text()

Other ggtour proto: filmstrip(), ggtour(), proto_default(), proto_density(), proto_hex(), proto_highlight(), proto_origin(), proto_point(), proto_text()

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
29
30
31
32
dat <- scale_sd(tourr::flea[, 1:6])
clas <- tourr::flea$species
bas <- basis_pca(dat)
mv <- manip_var_of(bas)

## 2D case:
mt_path <- manual_tour(bas, manip_var = mv)

ggt <- ggtour(mt_path, dat, angle = .2) +
  proto_basis()
## Not run: 
animate_plotly(ggt)
## End(Not run)

## Customize basis
ggt2 <- ggtour(mt_path, dat) +
  proto_basis(position = "right", manip_col = "green",
              line_size = .8, text_size = 8)
## Not run: 
animate_plotly(ggt2)
## End(Not run)

## 1D case:
bas1d <- basis_pca(dat, d = 1)
mv <- manip_var_of(bas, 3)
mt_path1d <- manual_tour(bas1d, manip_var = mv)

ggt1d <- ggtour(mt_path1d, dat, angle = .2) +
  proto_basis1d()
## Not run: 
animate_plotly(ggt1d)
## End(Not run)

spinifex documentation built on Sept. 28, 2021, 5:09 p.m.