plot_pc_variance: Plot contribution of principal component to variance

Description Usage Arguments Examples

View source: R/lipidome_comparison_pca.R

Description

'plot_pc_variance' prints a barplot with a line of the contribution of principal components to the data variance

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
plot_pc_variance(
  data_frame,
  x,
  y,
  xlab = "dimensions",
  ylab = "variance [%]",
  title = "Scree plot",
  fill = "#35608DFF",
  hjust = -0.2
)

Arguments

data_frame

data frame. Contains eigenvalues, contribution to data variance and cummulative contribution to data variance for a PCA model.

x

column of data_frame. Column with principal component names.

y

column of data_frame. Column with eigenvalues/contribution to variance/ cummulative contribution to variance.

xlab

string. X-axis label. Default: "dimensions"

ylab

string. X-axis label. Default: "variance [%]"

title

string. Main title. Default: "Scree plot"

fill

string. Color of the barplot. Default: "#35608DFF"

hjust

numeric. Position of labels relative to the points in the graph. Default: -0.2

Examples

1
2
3
{iris_pca <- FactoMineR::PCA(dplyr::select_if(iris, is.numeric))
iris_eigen <- as.data.frame(factoextra::get_eigenvalue(iris_pca))
plot_pc_variance(iris_eigen, x = rownames(iris_eigen), y = iris_eigen$cumulative.variance.percent)}

lisaschneider0509/lipidomeComparisonR documentation built on Aug. 12, 2020, 12:52 a.m.