theme_umap_arrows | R Documentation |
Adds simplified axis indicators (arrows and labels) to a ggplot object, typically used for dimension reduction plots like UMAP or t-SNE.
theme_umap_arrows(
anchor_x = unit(6, "mm"),
anchor_y = unit(6, "mm"),
line_length = unit(12, "mm"),
arrow_length = unit(2.5, "mm"),
text_offset_x = unit(2.5, "mm"),
text_offset_y = unit(2.5, "mm"),
text_size = 10,
line_width = 1,
x_label = NULL,
y_label = NULL
)
anchor_x |
X-coordinate for the anchor point of the arrows, Default: unit(6, "mm") |
anchor_y |
Y-coordinate for the anchor point of the arrows, Default: unit(6, "mm") |
line_length |
Length of the arrow lines, Default: unit(12, "mm") |
arrow_length |
Length of the arrow heads, Default: unit(2.5, "mm") |
text_offset_x |
X-offset for the axis labels, Default: unit(2.5, "mm") |
text_offset_y |
Y-offset for the axis labels, Default: unit(2.5, "mm") |
text_size |
Font size for the axis labels, Default: 10 |
line_width |
Width of the arrow lines, Default: 1 |
x_label |
Custom label for the x-axis, Default: NULL (auto-detected) |
y_label |
Custom label for the y-axis, Default: NULL (auto-detected) |
This function creates a theme that adds simplified axis indicators to the bottom-left corner of a ggplot. It consists of two perpendicular arrows representing the x and y axes, along with their respective labels. This approach is particularly useful for dimension reduction plots like UMAP or t-SNE where traditional axes are often removed to reduce visual clutter. The function attempts to auto-detect axis labels, but custom labels can be provided.
A ggplot theme object that can be added to an existing ggplot
library(Seurat)
library(SeuratExtend)
features <- c("cluster", "orig.ident", "CD3D", "CD14")
# Add arrows to the overall plot
DimPlot2(pbmc, features = features, theme = NoAxes()) +
theme_umap_arrows()
# Add arrows to each subplot
DimPlot2(pbmc, features = features, theme = theme_umap_arrows())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.