Description Usage Arguments Details Value See Also Examples
Highlight gene expression data in a 2D-embedding (UMAP, tSNE, etc.).
1 | feat(embedding, expression, legend_name = "Expression")
|
embedding |
A matrix/data.frame/tibble/... with exactly two columns.
If colnames are missing, the axis will be named "Dim1" and "Dim2".
Other classes than matrix/data.frame/tibble are possible, as long as
|
expression |
Numeric vector with expression values of the gene of
interest. Order has to correspond to the row order in |
legend_name |
Text displayed above the legend. Most commonly the name of the displayed gene. |
This function discourages customization on purpose, because it bundles geoms, themes and settings that I found important for visualizing gene expression in scRNAseq data:
coord_fixed, to avoid distortion of embeddings
geom_point with size=.4, to ameliorate overplotting
No background grid, because distances and axis units in embeddings do not carry meaning for most dimensionality reduction techniques.
Intensity-coded color scales (viridis) displayed with log2-transformation. Makes visualization independent of colorblindness and appropriate for gene expression data (which is usually Log Normal distributed).
Color scale breaks are displayed as 'closed interval', i.e.
max(expression)
and min(expression)
are the most extreme
breaks. Rounding makes them human-readable. This functionality is provided
by closed_breaks_log2 and closed_labels.
If you insist on customizing, think of this function as a great starting point, you can simply
copy-paste the code after typing feat
into your
console.
A ggplot2
object storing a colored scatter plot.
ggplot
,
closed_labels
,
closed_breaks_log2
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.