plot2.PCA: Plots Principal Component Analysis ala ggplot2

Description Usage Arguments Details Value Examples

View source: R/gr-PCA2.R

Description

Displays a PCA object with many useful layers in morphometrics, notably morphological space.

Usage

1
2
3
4
5
6
7
8
9
plot2(x, ...)

## S3 method for class 'PCA'
plot2(x, fac = NULL, xax = "PC1", yax = "PC2",
  points = TRUE, shapes = TRUE, shapes_pos = "full", ellipse = FALSE,
  ellipseax = FALSE, ellipse_type = "t", ellipse_level = 0.5,
  stars = FALSE, chull = FALSE, text, text_abbreviatemin = 1,
  text_size = 5, center = TRUE, legend_position = "bottom",
  title = substitute(x), return_df = FALSE, ...)

Arguments

x

a PCA object

...

more arguments to be passed to xxx.

fac

(optionnal)

xax

the name of the component to plot on the x-axis, eg "PC1"

yax

the name of the component to plot on the y-axis, eg "PC2"

points

logical whether to draw points

shapes

logical whether to draw shapes

shapes_pos

a position parameter xxx either "axes", "full", "range", "circle", "xy" or a custom data.frame of positions

ellipse

logical whether to draw confidence ellipses

ellipseax

logical whether to draw confidence ellipses axes

ellipse_type

character one of the available type in ggplot2::stat_ellipse

ellipse_level

numeric the confidence level for ellipses

stars

logical whether to draw segments between every point and their group centroid

chull

logical whether to draw convex hull

text

numeric : 1 is for labelling every shape, 2 for group centroids, 3 is for evry shape using group names

text_abbreviatemin

numeric if not missing, the min.length sensu abbreviate

text_size

numeric to adjust the size of labels

center

logical whether to center the plot

legend_position

character for theme(legend.position), either "none", "top", "bottom", "left", "right"

title

character a title for the plot

return_df

logical whether to return ggplot or the data_frames behind

Details

Detail the df_s. Detail the calculations.

Value

a ggplot object or a list of data.frames :

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#data(bot)
#bp <- PCA(efourier(bot, 8))
#plot2(bp)
#plot2(bp, "type")
#plot2(bp, "type", ellipse=TRUE)
# data(bot)

# bot$fac$fake <- factor(rep(letters[1:4], 10))
# bot$fac$fake2 <- c(runif(20), runif(20, 5, 10))
# xx + stat_density2d(aes(fill = ..level..), geom="polygon", alpha=0.1)

Example output

This is Momocs 1.1.6

Attaching package: 'Momocs'

The following object is masked from 'package:stats':

    filter

The following object is masked from 'package:base':

    table

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 

Momocs documentation built on Sept. 28, 2017, 9:04 a.m.