ggordpoint: ordination plotter based on ggplot2.

View source: R/plot-ggordpoint.R

ggordpointR Documentation

ordination plotter based on ggplot2.

Description

ordination plotter based on ggplot2.

Usage

ggordpoint(obj, ...)

## Default S3 method:
ggordpoint(
  obj,
  pc = c(1, 2),
  mapping = NULL,
  sampleda = NULL,
  factorNames = NULL,
  factorLevels = NULL,
  poinsize = 2,
  linesize = 0.3,
  arrowsize = 1.5,
  arrowlinecolour = "grey",
  ellipse = FALSE,
  showsample = FALSE,
  ellipse_pro = 0.9,
  ellipse_alpha = 0.2,
  ellipse_linewd = 0.5,
  ellipse_lty = 3,
  biplot = FALSE,
  topn = 5,
  settheme = TRUE,
  speciesannot = FALSE,
  fontsize = 2.5,
  labelfactor = NULL,
  stroke = 0.1,
  fontface = "bold.italic",
  fontfamily = "sans",
  textlinesize = 0.02,
  ...
)

## S3 method for class 'pcasample'
ggordpoint(obj, ...)

Arguments

obj

prcomp class or pcasample class,

...

additional parameters, see geom_text_repel.

pc

integer vector, the component index.

mapping

set of aesthetic mapping of ggplot2, default is NULL when your want to set it by yourself, only alpha can be setted, and the first element of factorNames has been setted to map 'fill', and the second element of factorNames has been setted to map 'starshape', you can add 'scale_starshape_manual' of 'ggstar' to set the shapes.

sampleda

data.frame, nrow sample * ncol factors, default is NULL.

factorNames

vector, the names of factors contained sampleda.

factorLevels

list, the levels of the factors, default is NULL, if you want to order the levels of factor, you can set this.

poinsize

numeric, the size of point, default is 2.

linesize

numeric, the line size of segment, default is 0.3.

arrowsize

numeric, the size of arrow, default is 1.5.

arrowlinecolour

character, the color of segment, default is grey.

ellipse

logical, whether add confidence ellipse to ordinary plot, default is FALSE.

showsample

logical, whether show the labels of sample, default is FALSE.

ellipse_pro

numeric, confidence value for the ellipse, default is 0.9.

ellipse_alpha

numeric, the alpha of ellipse, default is 0.2.

ellipse_linewd

numeric, the width of ellipse line, default is 0.5.

ellipse_lty

integer, the type of ellipse line, default is 3

biplot

logical, whether plot the species, default is FALSE.

topn

integer or vector, the number species have top important contribution, default is 5.

settheme

logical, whether set the theme for the plot, default is TRUE.

speciesannot

logical, whether plot the species, default is FALSE.

fontsize

numeric, the size of text, default is 2.5.

labelfactor

character, the factor want to be show in label, default is NULL.

stroke

numeric, the line size of points, default is 0.1.

fontface

character, the font face, default is "blod.italic".

fontfamily

character, the font family, default is "sans".

textlinesize

numeric, the segment size in geom_text_repel.

Value

point figures of PCA or PCoA.

Author(s)

Shuangbin Xu

Examples

## Not run: 
library(phyloseq)
data(GlobalPatterns)
subGlobal <- subset_samples(GlobalPatterns,
         SampleType %in% c("Feces", "Mock", "Ocean", "Skin"))
pcares <- get_pca(subGlobal, method="hellinger")
pcaplot <- ggordpoint(pcares, biplot=TRUE,
                    speciesannot=TRUE,
                     factorNames=c("SampleType"), ellipse=TRUE)

## End(Not run)

xiangpin/MicrobiotaProcess documentation built on July 24, 2024, 11:44 p.m.