Learn R Programming

statisR (version 1.0.1)

plot.statis.circle: Plot a Correlation Circle (Unit Circle)

Description

This function generates a correlation circle plot from two-dimensional coordinates, commonly used in principal component analysis (PCA) or other multivariate methods.

Usage

# S3 method for statis.circle
plot(points, inertia = 100, labels = NULL, title = "")

Value

A ggplot object with the generated plot.

Arguments

points

A matrix or data frame with two numeric columns (x, y) representing the coordinates of the vectors.

inertia

A number between 0 and 100 representing the percentage of explained inertia. It is displayed in the title.

labels

A character vector with labels for the points (optional). If not specified, labels are left blank.

title

Optional text used as the main title of the plot.

Details

Arrows are drawn from the origin to each point specified in points. A reference circle with radius 1 is displayed. You can also show the percentage of explained inertia and point labels.

The inertia argument is flexible and can be passed as the second or third parameter if argument names are omitted.

See Also

statis

Examples

Run this code
data(expert1, expert2, expert3)

labels <- c("Expert 1", "Expert 2", "Expert 3")

# If you want to select an specific table or row just set the parameters in the statis function.

res <- statis(list(expert1, expert2, expert3), table.labels = labels)

# Circle of correlations of all the tables
inter <- res$circle.inter
plot.statis.circle(inter$points, inter$inertia, inter$labels, inter$title)

# Circle of correlations of all variables evolution
intra <- res$circle.intra
plot.statis.circle(intra$points, intra$inertia, intra$labels, intra$title)

Run the code above in your browser using DataLab