R: Plot a Random Tour

randomTour {flexclust} | R Documentation

## Plot a Random Tour

### Description

Create a series of projection plots corresponding to a random tour through the data.

### Usage

    randomTour(object, ...)

    ## S4 method for signature 'ANY'
    randomTour(object, ...)
    ## S4 method for signature 'matrix'
    randomTour(object, ...)
    ## S4 method for signature 'flexclust'
    randomTour(object, data=NULL, col=NULL, ...)

    randomTourMatrix(x, directions=10,
                     steps=100, sec=4, sleep = sec/steps,
                     axiscol=2, axislab=colnames(x),
                     center=NULL, radius=1, minradius=0.01, asp=1,
                     ...)

### Arguments

`object, x` | A matrix or an object of class `"flexclust"`.
`data` | Data to include in plot.
`col` | Plotting colors for data points.
`directions` | Integer value, how many different directions are toured.
`steps` | Integer, number of steps in each direction.
`sec` | Numerical, lower bound for the number of seconds each direction takes.
`sleep` | Numerical, sleep for as many seconds after each picture has been plotted.
`axiscol` | If not `NULL`, then arrows are plotted for projections of the original coordinate axes in these colors.
`axislab` | Optional labels for the projected axes.
`center` | Center of the coordinate system to use in projected space. Default is the center of the plotting region.
`radius` | Relative size of the arrows.
`minradius` | Minimum radius of arrows to include.
`asp, ...` | Passed on to `randomTourMatrix` and from there to `plot`.

### Details

Two random locations are chosen, and data then projected onto hyperplanes which are orthogonal to `step` vectors interpolating the two locations. The first two coordinates of the projected data are plotted. If `directions` is larger than one, then after the first `steps` plots one more random location is chosen, and the procedure is repeated from the current position to the new location, etc..

The whole procedure is similar to a grand tour, but no attempt is made to optimize subsequent directions, `randomTour` simply chooses a random direction in each iteration. Use `rggobi` for the real thing.

Obviously the function needs a reasonably fast computer and graphics device to give a smooth impression, for `x11` it may be necessary to use `type="Xlib"` rather than cairo.

### Author(s)

Friedrich Leisch

### Examples

    if(interactive()){
      par(ask=FALSE)
      randomTour(iris[,1:4], axiscol=2:5)
      randomTour(iris[,1:4], col=as.numeric(iris$Species), axiscol=4)

      x <- matrix(runif(300), ncol=3)
      x <- rbind(x, x+1, x+2)
      cl <- cclust(x, k=3, save.data=TRUE)

      randomTour(cl, center=0, axiscol="black")

      ## now use predicted cluster membership for new data as colors
      randomTour(cl, center=0, axiscol="black",
                 data=matrix(rnorm(3000, mean=1, sd=2), ncol=3))
    }

[Package flexclust version 1.3-4 Index]