Description Usage Arguments Value
View source: R/make_tSNEplot.2.R
Plot 2D tSNE graph given a data frame. Tailor graphing parameters and save figure in working directory id needed. Can also spit out the tSNE dimensions if requested. Allows for setting perplexity.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | make_tSNEplot.2(
df,
dims = 2,
perplexity = 30,
spitOut_tSNE_dims = TRUE,
colorVec,
label = FALSE,
label_dist = 0.05,
main = "tSNE",
cex = 1,
pch = 16,
addLegend = FALSE,
plotOut = FALSE,
width = 13,
height = 8,
plotOutName = "PCA.pdf",
legendPosition = "topright",
legendNames = NA,
legendColors = NA,
horizontal = NA,
vertical = NA
)
|
df |
A data frame on which PCA plot is based. It is transposed before inputting to tSNE algorithm. |
dims |
A numeric of the number of tSNE dimensions to compute. Defults to 2. |
perplexity |
A numeric whose 3 times multiplication must be greater than number of columns minus 1. Defults to 30. |
spitOut_tSNE_dims |
A boolean indicating whether to output the tSNE dimensions as a data frame and assign them to a variable. |
colorVec |
A vector of colors corresponding to column names of df. Coerced to characted. Defaults to "black" (see http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf). |
label |
A boolean indicating whether to add labels to PCA dots. Defaults to FALSE. |
label_dist |
A numeric of the vertical distance between a dot and dot label. Defaults to 0.05. |
main |
A character of plot title. Defaults to "PCA". |
cex |
Either a single numeric of label size or a vector of point size. Defaults to a single numeric 1. |
pch |
A numeric specifying the type of points in the scatter. Defults to 16 which yields filled circles. If many types of points needed please supply a redundant vector of plotting symbol codes (see http://www.statmethods.net/advgraphs/parameters.html) of lenght equal to column names. E.g. pch=c(16,13)[c(rep(1,15),rep(2,125))] |
addLegend |
A boolean indicating whether to add the legend of colors used in the plot. |
plotOut |
A boolean indicating whether to save a plot figure in the working directory. |
width |
A numeric of plot's figure width (applicable only when plotOut==TRUE). |
height |
A numeric of plot's figure height (applicable only when plotOut==TRUE). |
plotOutName |
A character of plot figure file name (applicable only when plotOut==TRUE). |
legendPosition |
A character indicating position of legend. One of "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center. Defults to "topright". |
legendNames |
A character vector of legend names. Defults to NA. |
legendColors |
A character vector of colors corresponding to legendNames. Must be in the same left-to-right order (see http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf). |
horizontal |
A numeric indicating where the draw a horizontal line. Defults to NA. |
vertical |
A numeric indicating where to draw a vertical line. Defults to NA. |
A tSNE plot and tSNE coordinates if requested.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.