pretty_pca_plot: Pretty PCA Plot

Description Usage Arguments Value Examples

View source: R/pretty_pca_plot.r

Description

This function takes a PCA object and a dates vector. The dates are processed and split in day, months, and years. The pca is then plotted and points are connected through time, to see the evolution of the lake communities.

Usage

1
pretty_pca_plot(obj, dates, type = "default", ...)

Arguments

obj

A PCA object computed with prcomp or princomp

dates

a vector of dates

type

'default' or 'ggplot' to decide which kind of graph you want to do

...

optional parameters to be passed to the plot function

Value

a beautiful plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
year <- c(rep(2014,12), rep(2015, 12), rep(2016, 12))
month <- rep(1:12, 3)
day <- sample(1:28, 36, replace = TRUE)
my_date <- paste(year, month, day, sep="-")


data <- matrix(ncol = 10,
               nrow = 36,
               data = rnorm(360))

data.pca <- prcomp(data)
pretty_pca_plot(data.pca, my_date, main = "test plot")

nibortolum/brunisol documentation built on Nov. 4, 2019, 10:14 p.m.