Skip to contents

Introduction

scVeloR provides a comprehensive suite of visualization tools for exploring RNA velocity results. This gallery demonstrates the various plot types available and their customization options.

Velocity Embedding Plot

The velocity embedding plot shows velocity arrows overlaid on the low-dimensional embedding (UMAP/tSNE).

Basic Usage

# Basic velocity arrows
plot_velocity(seurat_obj, embedding = "umap")

# Colored by cluster
plot_velocity(seurat_obj, 
              embedding = "umap", 
              color_by = "seurat_clusters")

# Colored by latent time
plot_velocity(seurat_obj, 
              embedding = "umap", 
              color_by = "latent_time")

Customization Options

# Customize arrow appearance
plot_velocity(seurat_obj,
              embedding = "umap",
              color_by = "celltype",
              arrow_scale = 1.5,      # Arrow length
              arrow_length = 0.2,     # Arrow head size
              alpha = 0.8,            # Point transparency
              size = 0.8,             # Point size
              n_arrows = 500,         # Subsample arrows
              title = "RNA Velocity Field")

Example Output

Velocity embedding plot showing directional flow of cells.

Velocity embedding plot showing directional flow of cells.

Streamline Plot

Streamlines provide a cleaner visualization of the overall velocity field.

Basic Usage

# Basic streamlines
plot_velocity_stream(seurat_obj, embedding = "umap")

# With custom density
plot_velocity_stream(seurat_obj,
                     embedding = "umap",
                     density = 1.5)

Example Output

Streamline plot showing smooth velocity flow patterns.

Streamline plot showing smooth velocity flow patterns.

Grid Plot

The grid plot displays averaged velocities on a regular grid.

Basic Usage

# Basic grid
plot_velocity_grid(seurat_obj, embedding = "umap")

# Custom grid resolution
plot_velocity_grid(seurat_obj,
                   embedding = "umap",
                   n_grid = 50,
                   arrow_scale = 1.2)

Example Output

Grid plot showing averaged velocity vectors.

Grid plot showing averaged velocity vectors.

Phase Portrait

Phase portraits show the relationship between spliced and unspliced mRNA for individual genes.

Basic Usage

# Single gene phase portrait
plot_phase(seurat_obj, gene = "Sox2")

# With fitted dynamics
plot_phase(seurat_obj, 
           gene = "Sox2", 
           show_fit = TRUE)

# Colored by latent time
plot_phase(seurat_obj,
           gene = "Sox2",
           color_by = "latent_time",
           show_fit = TRUE)

Example Output

Phase portrait showing spliced vs unspliced mRNA relationship.

Phase portrait showing spliced vs unspliced mRNA relationship.

Latent Time Visualization

Example Output

Cells colored by inferred latent time.

Cells colored by inferred latent time.

Velocity Confidence

Velocity confidence scores indicating reliability of estimates.

Velocity confidence scores indicating reliability of estimates.

Combined Visualizations

Multi-panel Figure

library(patchwork)

# Create multiple plots
p1 <- plot_velocity(seurat_obj, embedding = "umap", 
                    color_by = "clusters", title = "Velocity")
p2 <- plot_velocity_stream(seurat_obj, embedding = "umap",
                           title = "Streamlines")
p3 <- plot_phase(seurat_obj, gene = "Sox2", 
                 show_fit = TRUE, title = "Sox2 Phase")

# Combine
(p1 | p2) / p3

Customizing Colors

# Custom color palette for clusters
custom_colors <- c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3", 
                   "#FF7F00", "#FFFF33", "#A65628", "#F781BF")

plot_velocity(seurat_obj, 
              embedding = "umap",
              color_by = "clusters") +
  ggplot2::scale_color_manual(values = custom_colors)

# Custom continuous color scale
plot_velocity(seurat_obj,
              embedding = "umap",
              color_by = "latent_time") +
  ggplot2::scale_color_viridis_c(option = "magma")

Exporting Figures

# High-resolution export
p <- plot_velocity(seurat_obj, embedding = "umap")

ggsave("velocity_plot.pdf", p, width = 8, height = 6, dpi = 300)
ggsave("velocity_plot.png", p, width = 8, height = 6, dpi = 300)

Session Information

sessionInfo()
#> R version 4.4.0 (2024-04-24)
#> Platform: aarch64-apple-darwin20
#> Running under: macOS 15.6.1
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
#> 
#> locale:
#> [1] C
#> 
#> time zone: Asia/Shanghai
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] ggplot2_4.0.1
#> 
#> loaded via a namespace (and not attached):
#>  [1] gtable_0.3.6       jsonlite_2.0.0     dplyr_1.1.4        compiler_4.4.0    
#>  [5] tidyselect_1.2.1   dichromat_2.0-0.1  jquerylib_0.1.4    systemfonts_1.3.1 
#>  [9] scales_1.4.0       textshaping_1.0.4  yaml_2.3.12        fastmap_1.2.0     
#> [13] R6_2.6.1           labeling_0.4.3     generics_0.1.4     knitr_1.51        
#> [17] htmlwidgets_1.6.4  tibble_3.3.1       desc_1.4.3         bslib_0.9.0       
#> [21] pillar_1.11.1      RColorBrewer_1.1-3 rlang_1.1.7        cachem_1.1.0      
#> [25] xfun_0.56          fs_1.6.6           sass_0.4.10        S7_0.2.1          
#> [29] otel_0.2.0         viridisLite_0.4.2  cli_3.6.5          pkgdown_2.1.3     
#> [33] withr_3.0.2        magrittr_2.0.4     digest_0.6.39      grid_4.4.0        
#> [37] lifecycle_1.0.5    vctrs_0.7.1        evaluate_1.0.5     glue_1.8.0        
#> [41] farver_2.1.2       ragg_1.5.0         rmarkdown_2.30     tools_4.4.0       
#> [45] pkgconfig_2.0.3    htmltools_0.5.9