Learn R Programming

debrowser (version 1.0.8)

plot_pca: plot_pca

Description

Plots the PCA results for the selected dataset.

Usage

plot_pca(x = NULL, pcx = 1, pcy = 2, explained = NULL, metadata = NULL, color = NULL, shape = NULL, size = NULL, factors = NULL)

Arguments

x,
dataframe with data
pcx,
x axis label
pcy,
y axis label
explained,
additional axis data
metadata,
additional data
color,
color for plot
shape,
shape for plot
size,
size of the plot
factors,
factors of the plot

Value

pca list

Examples

Run this code
    load(system.file("extdata", "demo", "demodata.Rda",
            package="debrowser"))
    pca_data<-run_pca(getNormalizedMatrix(
            demodata[rowSums(demodata[,2:7])>10,2:7]))
    metadata<-cbind(colnames(demodata[,2:7]), 
            c(rep("Cond1",3), rep("Cond2",3)))
    colnames(metadata)<-c("samples", "conditions")

    a <- plot_pca(pca_data$PCs, explained = pca_data$explained,
            metadata = metadata, color = "samples",
            size = 5, shape = "conditions",
            factors = c("samples", "conditions"))

Run the code above in your browser using DataLab