fortify.Assay | R Documentation |
ggplot()
Generate a long-format data frame for ease of use with
ggplot()
; as a bonus, this method enables direct
calling of Assay
objects in
ggplot()
(see examples)
## S3 method for class 'Assay'
fortify(
model,
data,
features = NULL,
layer = c("data", "scale.data", "counts"),
na.rm = FALSE,
...
)
model |
An |
data |
A |
features |
A vector of features to include in the fortified data; defaults to the variable features |
layer |
Name of layer to pull expression data for |
na.rm |
Remove values with |
... |
Ignored |
fortify.Assay()
generates a data frame based on the
expression data stored in layer
; automatically creates a column for
cell names (“cell
”). Also creates creates a column for
identity classes (“ident
”) if not present in data
; the
default identity class is
\Sexpr[stage=render, results=rd]{ggseurat::.rd_ident()}; final column output
order is:
“cell
”
“ident
”
expression data for features
additional meta data provided by data
A long-format data frame for use with ggplot()
ggplot2::ggplot()
,
ggplot2::fortify()
Visualize Assay Expression Data:
autolayer.Assay()
,
autoplot.Assay()
data("pbmc_small")
rna <- pbmc_small[["RNA"]]
md <- FetchData(pbmc_small, vars = "ident")
# Create a data frame for `ggplot()`
df <- fortify(rna, data = md)
head(df)
ggplot(df, mapping = aes(x = ident, y = PPBP, fill = ident)) +
geom_violin()
# Use an `Assay` directly in `ggplot()`
ggplot(rna, mapping = aes(x = ident, y = GNLY, fill = ident), md) +
geom_violin()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.