plot_pca | R Documentation |
Multiple options for plotting descriptive statistics from PCA. Takes a numeric data frame as input.
plot_pca(
dat,
metadata = NULL,
join_by_name = "Sample",
plotting_factors_name = Group,
plotting_factors_in = "col_names",
x = "PC1",
y = "PC2",
scale = T,
center = T,
color = "Group",
fill = "Group",
plot_type = "2D",
points_label = "Group",
summarise_for_scatter = T,
sep = "-"
)
dat |
A data.frame |
metadata |
Optional data frame with metadata for filling, coloring, or plotting PCA results against. |
join_by_name |
Name of column in metadata that matches rownames/colnames of data. Used to join metadata with data. This is usually sample names. For example, sample1.1, sample1.2, etc. |
plotting_factors_name |
Name for factor you want to plot. Is made by removing two characters from the end of 'join_by_name' variable. For example, sample1.1, sample1.2 and sample2.1, sample2.2 in this variable become sample1, sample1 and sample2, sample2. Used for coloring, filling, and grouping of plot. Default name is Group |
plotting_factors_in |
Location of plotting factors. Options are either 'col_names' or 'row_names'. |
x |
What do you want to plot on the x-axis? Default is 'PC1' |
y |
What do you want to plot on the y-axis? Default is 'PC2' |
scale |
Logical. Scale data? Default is TRUE |
center |
Logical. Center data? Default is TRUE |
color |
Which variable to color by? Default is 'Group'. |
fill |
Which variable to fill by? Default is 'Group'. |
plot_type |
One of three options: '2D', 'boxplot', or 'scatter'. Default is '2D'. |
points_label |
Which variable to label points by? Default is 'Group". |
summarise_for_scatter |
Logical. Plotting factors can sometimes contain psuedoreplication which inflates the p-value of this scatterplot. This option will summarize the plotting factors by mean, removing psuedoreplication for a more realistic p-value. Default is TRUE. |
sep |
Desired separator for sample names in data to match that of metadata |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.