Learn R Programming

fdm2id (version 0.9.1)

plotdata: Advanced plot function

Description

Plot a dataset.

Usage

plotdata(
  d,
  k = NULL,
  type = c("pairs", "scatter", "boxplot", "pca", "cda", "svd", "nmf", "tsne", "som"),
  legendpos = "topleft",
  alpha = 200,
  asp = 1,
  labels = FALSE,
  ...
)

Arguments

d

A numeric dataset (data.frame or matrix).

k

A categorial variable (vector or factor).

type

The type of graphic to be plotted.

legendpos

Position of the legend

alpha

Color opacity (0-255).

asp

Aspect ratio (default: 1).

labels

Indicates whether or not labels (row names) should be showned on the (scatter) plot.

...

Other parameters.

Examples

Run this code
# NOT RUN {
require (datasets)
data (iris)
# Without classification
plotdata (iris [, -5]) # D<U+00E9>fault (pairs)
# With classification
plotdata (iris [, -5], iris [, 5]) # D<U+00E9>fault (pairs)
plotdata (iris [, -5], iris [, 5], type = "scatter") # Scatter plot (PCA axis)
plotdata (iris [, -5], iris [, 5], type = "boxplot") # Boxplot
plotdata (iris [, -5], iris [, 5], type = "pca") # Scatter plot (PCA axis)
plotdata (iris [, -5], iris [, 5], type = "cda") # Scatter plot (CDA axis)
plotdata (iris [, -5], iris [, 5], type = "svd") # Scatter plot (SVD axis)
plotdata (iris [, -5], iris [, 5], type = "som") # Kohonen map
# With only one variable
plotdata (iris [, 1], iris [, 5]) # D<U+00E9>fault (data vs. index)
plotdata (iris [, 1], iris [, 5], type = "scatter") # Scatter plot (data vs. index)
plotdata (iris [, 1], iris [, 5], type = "boxplot") # Boxplot
# With two variables
plotdata (iris [, 3:4], iris [, 5]) # D<U+00E9>fault (scatter plot)
plotdata (iris [, 3:4], iris [, 5], type = "scatter") # Scatter plot
# }

Run the code above in your browser using DataLab