Package pca3d. February 17, 2017

Similar documents
Package desplot. R topics documented: April 3, 2018

Package Mondrian. R topics documented: March 4, Type Package

Package explor. R topics documented: October 10, Type Package Title Interactive Interfaces for Results Exploration Version 0.3.

Package pairsd3. R topics documented: August 29, Title D3 Scatterplot Matrices Version 0.1.0

Package sciplot. February 15, 2013

Package cgh. R topics documented: February 19, 2015

Package qrfactor. February 20, 2015

Package RCA. R topics documented: February 29, 2016

Package EnQuireR. R topics documented: February 19, Type Package Title A package dedicated to questionnaires Version 0.

Package DiffCorr. August 29, 2016

Package munfold. R topics documented: February 8, Type Package. Title Metric Unfolding. Version Date Author Martin Elff

Package areaplot. October 18, 2017

Package ClustGeo. R topics documented: July 14, Type Package

Package Numero. November 24, 2018

Package pathdiagram. R topics documented: August 29, 2016

Package sankey. R topics documented: October 22, 2017

Package nprotreg. October 14, 2018

Package omu. August 2, 2018

Package ECctmc. May 1, 2018

Package docxtools. July 6, 2018

Package spark. July 21, 2017

Package beanplot. R topics documented: February 19, Type Package

Package JBTools. R topics documented: June 2, 2015

Package OptimaRegion

Package Grid2Polygons

Package r2d2. February 20, 2015

Package leaflet.minicharts

The RcmdrPlugin.HH Package

Package gifti. February 1, 2018

Package condir. R topics documented: February 15, 2017

Package GCAI.bias. February 19, 2015

Package SFtools. June 28, 2017

Package seg. February 15, 2013

Package fso. February 19, 2015

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package gains. September 12, 2017

Package corclass. R topics documented: January 20, 2016

Package MeanShift. R topics documented: August 29, 2016

Package optimus. March 24, 2017

Package feature. R topics documented: July 8, Version Date 2013/07/08

Package blandr. July 29, 2017

Package sizemat. October 19, 2018

Package alphashape3d

Package R2SWF. R topics documented: February 15, Version 0.4. Title Convert R Graphics to Flash Animations. Date

Package panelview. April 24, 2018

Package sspline. R topics documented: February 20, 2015

Package multigraph. R topics documented: January 24, 2017

Package mpm. February 20, 2015

Package weco. May 4, 2018

Package superheat. February 4, 2017

Package basictrendline

Package GFD. January 4, 2018

Visualization and PCA with Gene Expression Data

Package lvplot. August 29, 2016

Package feature. R topics documented: October 26, Version Date

Package canvasxpress

Package hextri. April 22, 2016

Package reval. May 26, 2015

Rectangular Coordinates in Space

Package meme. December 6, 2017

Package fastdummies. January 8, 2018

Package dynsim. R topics documented: August 29, 2016

Package SSRA. August 22, 2016

Package cosinor. February 19, 2015

Package qicharts2. March 3, 2018

Package GLDreg. February 28, 2017

Package multigraph. R topics documented: November 1, 2017

Package TPD. June 14, 2018

Package coefplot. R topics documented: February 15, Type Package. Title Plots Coefficients from Fitted Models. Version

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package hbm. February 20, 2015

Package osrm. November 13, 2017

Package JOP. February 19, 2015

Package meme. November 2, 2017

Package r.jive. R topics documented: April 12, Type Package

Package ICSOutlier. February 3, 2018

Package Combine. R topics documented: September 4, Type Package Title Game-Theoretic Probability Combination Version 1.

Package epitab. July 4, 2018

Package extremevalues

Package erp.easy. March 2, 2017

Package kdtools. April 26, 2018

Package glmnetutils. August 1, 2017

Package ipft. January 4, 2018

Visualization and PCA with Gene Expression Data. Utah State University Fall 2017 Statistical Bioinformatics (Biomedical Big Data) Notes 4

Package abf2. March 4, 2015

Package PDN. November 4, 2017

Package InPosition. R topics documented: February 19, 2015

Package CorporaCoCo. R topics documented: November 23, 2017

Package gridgraphics

Package NORTARA. February 19, 2015

Package editdata. October 7, 2017

Package qicharts. October 7, 2014

Package CINID. February 19, 2015

Package Binarize. February 6, 2017

Package Daim. February 15, 2013

Package gridextra. September 9, 2017

Package dyncorr. R topics documented: December 10, Title Dynamic Correlation Package Version Date

Package textrank. December 18, 2017

Package esabcv. May 29, 2015

Package Umatrix. December 18, 2017

Transcription:

Package pca3d Type Package Title Three Dimensional PCA Plots Version 0.10 Date 2017-02-17 Author January Weiner February 17, 2017 URL http://logfc.wordpress.com Maintainer January Weiner <january.weiner@gmail.com> Functions simplifying presentation of PCA models in a 3D interactive representation using 'rgl'. License GPL-2 Imports rgl,ellipse Suggests knitr VignetteBuilder knitr NeedsCompilation no Repository CRAN Date/Publication 2017-02-17 14:38:20 R topics documented: defaultpalettepca3d.................................... 2 listshapes.......................................... 2 makemoviepca....................................... 3 metabo............................................ 3 pca2d............................................ 4 snapshotpca3d....................................... 7 Index 8 1

2 listshapes defaultpalettepca3d Default palette Default set of colors for the pca3d package. This is a colorblind-friendly palette, following the R cookbook. defaultpalettepca3d(n = NULL, transparent = NULL, d3 = FALSE) Arguments n transparent d3 Number of colors to return character string which will be pasted to each color if true, no transparency information will be added to the colors The default palette contains 21 colors. Value A character vector with the color palette listshapes Show all permissible shapes for pca3d Value Show all permissible shapes for pca3d listshapes() Show all permissible shapes for the functions pca3d and pca2d. The shapes may be abbreviated using (matching is done with pmatch. A data frame with permissible 3d shapes for plotting and their pch counterparts is returned invisibly.

makemoviepca 3 makemoviepca Create a PCA movie Make a basic movie using movie3d() makemoviepca(...) Arguments... Any parameters will be passed to movie3d() A wrapper around movie3d with some default settings. Used to create a movie on the fly. Value The value returned by movie3d() Examples ## Not run: data( metabo ) pca <- prcomp( metabo[,-1], scale.= TRUE ) pca3d(pca, group=metabo[,1]) makemoviepca() ## End(Not run) metabo Metabolic profiles in tuberculosis. Relative abundances of metabolites from serum samples of three groups of individuals A data frame with 136 observations on 425 metabolic variables. Serum samples from three groups of individuals were compared: tuberculin skin test negative (NEG), positive (POS) and clinical tuberculosis (TB).

4 pca2d References Weiner J 3rd, Parida SK, Maertzdorf J, Black GF, Repsilber D, et al. (2012) Biomarkers of Inflammation, Immunosuppression and Stress Are Revealed by Metabolomic Profiling of Tuberculosis Patients. PLoS ONE 7(7): e40221. doi:10.1371/journal.pone.0040221 Examples data(metabo) # maybe str(metabo) ; plot(metabo)... pca <- prcomp( metabo[,-1] ) pca2d Show a three- or two-dimensional plot of a prcomp object Show a three- two-dimensional plot of a prcomp object or a matrix, using different symbols and colors for groups of data pca2d(pca, components = 1:2, col = NULL, title = NULL, new = FALSE, axes.color = "black", bg = "white", radius = 1, group = NULL, shape = NULL, palette = NULL, fancy = FALSE, biplot = FALSE, biplot.vars = 5, legend = NULL, show.scale = FALSE, show.labels = FALSE, labels.col = "black", show.axes = TRUE, show.axe.titles = TRUE, axe.titles = NULL, show.plane = TRUE, show.shadows = FALSE, show.centroids = FALSE, show.group.labels = FALSE, show.ellipses = FALSE, ellipse.ci = 0.95,...) pca3d(pca, components = 1:3, col = NULL, title = NULL, new = FALSE, axes.color = "grey", bg = "white", radius = 1, group = NULL, shape = NULL, palette = NULL, fancy = FALSE, biplot = FALSE, biplot.vars = 5, legend = NULL, show.scale = FALSE, show.labels = FALSE, labels.col = "black", show.axes = TRUE, show.axe.titles = TRUE, axe.titles = NULL, show.plane = TRUE, show.shadows = FALSE, show.centroids = FALSE, show.group.labels = FALSE, show.shapes = TRUE, show.ellipses = FALSE, ellipse.ci = 0.95) Arguments pca components col title Either a prcomp object or a matrix with at least three columns Vector of length 3 (pca3d) or 2 (pca2d) containing the components to be shown Either a single value or a vector of length equal to number of rows, containing color definitions for the plot points to be shown Window title

pca2d 5 new axes.color bg radius group shape palette fancy biplot biplot.vars legend show.scale show.labels labels.col Use TRUE to open a new window Axis color This option has no effect in pca2d. Background color Scaling item for the size of points to be shown. In pca2d, this corresponds to the cex parameter. either NULL or a factor of length equal to number of rows. Factor levels can be used to automatically generate symbols and colors for the points shown Either a single value or a character vector describing the shapes to be used when drawing data points. Allowed shapes are: sphere, tetrahaedron and cube, and may be abbreviated. In pca2d, the parameter is passed directly on to the pch option of the points() function. Specifies the color palette when colors are automatically assigned to the groups. See. set show.labels, show.shadows, show.centroids and show.group.labels to TRUE. Specify whether to show a biplot (see section biplots below) Specify which loading to show on the biplot (see section biplots below) If NULL, no legend will be drawn. Otherwise the value specifies the legend position in a form accepted by legend and legend3d. TRUE for showing a numeric scale at the edges of the plot. This option has no effect in pca2d. TRUE for showing labels (taken from the coordinate matrix or the prcomp object). Alternatively, a vector with labels to be shown next to the data points. Single value or vector describing the colors of the labels. show.axes TRUE to show the axes. This option has no effect in pca2d. show.axe.titles If TRUE, show axe titles (PC 1, PC 2 etc.) This option has no effect in pca2d. axe.titles show.plane show.shadows A vector with two (pca2d) or three (pca3d) values containing the axe titles (corresponds to xlab and ylab in regular plot). If missing, but show.axe.titles is TRUE, axe titles will be generated automatically. If TRUE, show a grey horizontal plane at y = 0. This option has no effect in pca2d. If TRUE, show a "lollipop" representation of the points on the y = 0 plane: a vertical line joining the data point with the plane and a shadow. In pca2d, for each sample at (x,y), a grey line is drawn from (x,y) to (x,0). show.centroids If TRUE and the group variable is defined, show cluster centroids (using apropriate group symbols) and lines from each data point to the corresponding centroid. show.group.labels Either TRUTH/FALSE or a vector equal to the number of unique values in the group parameter. If set, labels for each of the defined group will be shown at the group s centroid. If the value of the parameter is TRUE, then the group names will be taken from the group parameter. Otherwise, the values from this parameter will be used.

6 pca2d Value Biplots show.ellipses ellipse.ci A TRUTH/FALSE value indicating whether to show confidence interval ellipses or ellipsoids around each defined group The confidence level of a pairwise confidence region for the CI. The default is 0.95, for a 95 the size of the ellipse being plotted.... For pca2d, any further argument will be passed on to the points() function. show.shapes A TRUTH/FALSE value indicating whether the different symbols (shapes) for the shown data points should be plotted (default TRUE). The pca3d function shows a three dimensional representation of a PCA object or any other matrix. It uses the rgl package for rendering. pca2d is the 2D counterpart. It creates a regular, two-dimensional plot on the standard graphic device. However, it takes exactly the same options as pca3d, such that it is easy to create 2D variants of the 3D graph. Often, PCA visualisation requires using different symbols and colors for different groups of data. pca3d() and pca2d() aim at creating reasonable defaults, such that a simple call with two parameters the pca object and the vector with group assignments of the samples is sufficient for a basic diagnosis. Both pca2d and pca3d return invisibly a data frame which can be used to generate a legend for the figure. The data frame has as many rows as there are groups, and column with the group name, assigned color and assigned shape. If option biplot is TRUE, a biplot showing both the PCA results (samples) and variables is shown. This corresponds to the biplot function which works for the prcomp class objects. However, a biplot showing all variable loadings will be unreadable if the data is highly dimensional (for example, gene expression data). Therefore, the option biplot.vars specifies which variables are shown on the biplot. If biplot.vars is a vector of length larger than one, it will be interpreted as a direct selection of the variables to be shown; for example, for a prcomp object pca, the variable selection will happen through pca$rotation[biplot.vars,]. If biplot.vars is a single number, then for each of the components shown, a number of variables equal to biplot.vars with the highest absolute loadings will be shown on the biplot. Examples data( metabo ) pca <- prcomp( metabo[,-1], scale.= TRUE ) pca3d( pca, group= metabo[,1] ) pca2d( pca, group= metabo[,1] ) ## a bit more fancy:

snapshotpca3d 7 ## black background, white axes, ## centroids pca3d( pca, group= metabo[,1], fancy= TRUE, bg= "black", axes.color= "white", new= TRUE ) snapshotpca3d Save a 3D PCA snapshot Take a snapshot of the 3D PCA to a file. snapshotpca3d(file) Arguments file Name of the file to save the snapshot to data( metabo ) pca <- prcomp( metabo[,- 1], scale.= TRUE ) pca3d(pca, group=metabo[,1]) snapshotpca3d("testfile.png") This is just a wrapper around rgl.snapshot.

Index Topic PCA Topic biplot Topic datasets metabo, 3 Topic prcomp Topic princomp biplot, 6 defaultpalettepca3d, 2 legend, 5 legend3d, 5 listshapes, 2 makemoviepca, 3 metabo, 3 pca3d (pca2d), 4 pca3d-package (pca2d), 4 pmatch, 2 prcomp, 6 snapshotpca3d, 7 8