Learn R Programming

MorphoRegions (version 0.1.0)

plot.regions_pco: Plot PCO axes

Description

plot() visualizes the relationship between a PCO axis and the vertebra or between pairs of PCO axes.

Usage

# S3 method for regions_pco
plot(x, pco_y = 1, pco_x = NULL, ...)

Value

A ggplot object.

Arguments

x

a regions_pco object; the output of a call to svdPCO().

pco_y, pco_x

number; PCO score indices for the y- and x-axes, respectively. pco_x can be NULL.

...

arguments passed to ggplot2::geom_text() when pco_x is not NULL. If scores is supplied as an argument, it will replace pco_y if unspecified.

Details

When pco_x is NULL (the default), plot() will display a scatterplot of the PCO axis identified by pco_y and vertebra position using ggplot2::geom_point(). This plot is similar to that generated by plotsegreg(). Otherwise, plot() uses ggplot2::geom_text() to identify vertebrae positions in the space corresponding to the requested PCOs.

See Also

svdPCO() for generating the PCO scores. plot.regions_sim() for plotting PCO scores against vertebra position for simulated PCOs. plotsegreg() for plotting PCO scores against vertebra position after selecting breakpoints for a segmented regression.

Examples

Run this code
data("alligator")

alligator_data <- process_measurements(alligator,
                                       pos = "Vertebra")

# Compute PCOs
alligator_PCO <- svdPCO(alligator_data,
                        metric = "gower")

alligator_PCO

# Plot PCOs against vertebra index
plot(alligator_PCO, pco_y = 1:2)

# Plot PCOs against each other
plot(alligator_PCO, pco_y = 1, pco_x = 2)

Run the code above in your browser using DataLab