getDimRedPlot | R Documentation |
Generate a plot from dimension reduction coordinates
getDimRedPlot(
coords,
annot = NULL,
colorCol = NULL,
shapeCol = NULL,
colScheme = "[auto]",
ptSize = 3,
addLabels = FALSE,
addDensity = FALSE,
addVoronoi = FALSE,
annot.text = NULL,
orderCol = NULL,
facetCols = NULL
)
coords |
dimension reduction coordinates |
annot |
annotation matrix with the same number of rows as |
colorCol |
name or index in the annotation matrix ( |
shapeCol |
name or index in the annotation matrix ( |
colScheme |
color sheme to be used in coloring the points. can be a character vector with the supplied colors. Alternatively, if it is a one-element character vector |
ptSize |
size of the points in the scatterplot |
addLabels |
should observation labels be added to each point |
addDensity |
should Gaussian Kernel density estimation be performed and the contour lines plotted for each color group |
addVoronoi |
should a Voronoi tessalation grid (based on |
annot.text |
optional text to be added in the lower right corner of the plot |
orderCol |
name or index in the annotation matrix ( |
facetCols |
name (string) of columns to be used for faceting the resulting plot. Each facet will contain all the points not in the facet as grey points. |
a ggplot2
object containing the dimension reduction plot
Fabian Mueller
df <- data.frame(
x = c(rnorm(20, mean=0, sd=0.2), rnorm(10, mean=1, sd=0.4), rnorm(15, mean=1, sd=0.2)),
y = c(rnorm(20, mean=0, sd=0.2), rnorm(10, mean=1, sd=0.4), rnorm(15, mean=0.5, sd=0.3)),
group = rep(c("group1", "group2", "group3"), times=c(20,10,15)),
stringsAsFactors=FALSE
)
getDimRedPlot(df[,c("x", "y")], annot=df[,c("group"), drop=FALSE], colorCol="group")
getDimRedPlot(df[,c("x", "y")], annot=df[,c("group"), drop=FALSE], colorCol="group", addDensity=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.