Contents

1 Introduction

The ggspavis package contains a set of visualization functions for spatially resolved transcriptomics data, designed to work with the SpatialExperiment Bioconductor object class.

These plotting functions are used in our online book OSTA and other work.

2 Examples

Load some example datasets from the STexampleData package and create some example plots.

library(SpatialExperiment)
library(STexampleData)
library(ggspavis)

2.1 10x Genomics Visium: mouse coronal brain section

# load data in SpatialExperiment format
spe <- Visium_mouseCoronal()
# add some values in 'colData' to annotate spots
colData(spe)$sum <- colSums(counts(spe))

# example plots
plotSpots(spe, annotate = "sum")

plotVisium(spe, fill = "sum", trans = "log", highlight = "in_tissue")

2.2 10x Genomics Visium: human brain (DLPFC)

# load data in SpatialExperiment format
spe <- Visium_humanDLPFC()
# example plots
plotSpots(spe, annotate = "ground_truth", palette = "libd_layer_colors")

plotVisium(spe, fill = "ground_truth", highlight = "in_tissue")

2.3 seqFISH: mouse embryo

# load data in SpatialExperiment format
spe <- seqFISH_mouseEmbryo()
# example plots
plotMolecules(spe, molecule = "Sox2")

3 Session information

sessionInfo()
## R version 4.3.3 (2024-02-29)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.4 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.18-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: America/New_York
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] BumpyMatrix_1.10.0          ggspavis_1.8.1             
##  [3] ggplot2_3.5.0               STexampleData_1.10.0       
##  [5] ExperimentHub_2.10.0        AnnotationHub_3.10.0       
##  [7] BiocFileCache_2.10.1        dbplyr_2.4.0               
##  [9] SpatialExperiment_1.12.0    SingleCellExperiment_1.24.0
## [11] SummarizedExperiment_1.32.0 Biobase_2.62.0             
## [13] GenomicRanges_1.54.1        GenomeInfoDb_1.38.8        
## [15] IRanges_2.36.0              S4Vectors_0.40.2           
## [17] BiocGenerics_0.48.1         MatrixGenerics_1.14.0      
## [19] matrixStats_1.2.0           BiocStyle_2.30.0           
## 
## loaded via a namespace (and not attached):
##  [1] tidyselect_1.2.1              viridisLite_0.4.2            
##  [3] farver_2.1.1                  dplyr_1.1.4                  
##  [5] blob_1.2.4                    filelock_1.0.3               
##  [7] Biostrings_2.70.3             bitops_1.0-7                 
##  [9] fastmap_1.1.1                 RCurl_1.98-1.14              
## [11] promises_1.2.1                digest_0.6.35                
## [13] mime_0.12                     lifecycle_1.0.4              
## [15] ellipsis_0.3.2                KEGGREST_1.42.0              
## [17] interactiveDisplayBase_1.40.0 RSQLite_2.3.5                
## [19] magrittr_2.0.3                compiler_4.3.3               
## [21] rlang_1.1.3                   sass_0.4.9                   
## [23] tools_4.3.3                   utf8_1.2.4                   
## [25] yaml_2.3.8                    knitr_1.45                   
## [27] labeling_0.4.3                S4Arrays_1.2.1               
## [29] bit_4.0.5                     curl_5.2.1                   
## [31] DelayedArray_0.28.0           abind_1.4-5                  
## [33] withr_3.0.0                   purrr_1.0.2                  
## [35] grid_4.3.3                    fansi_1.0.6                  
## [37] colorspace_2.1-0              xtable_1.8-4                 
## [39] scales_1.3.0                  cli_3.6.2                    
## [41] rmarkdown_2.26                crayon_1.5.2                 
## [43] generics_0.1.3                httr_1.4.7                   
## [45] rjson_0.2.21                  DBI_1.2.2                    
## [47] cachem_1.0.8                  zlibbioc_1.48.2              
## [49] AnnotationDbi_1.64.1          BiocManager_1.30.22          
## [51] XVector_0.42.0                vctrs_0.6.5                  
## [53] Matrix_1.6-5                  jsonlite_1.8.8               
## [55] bookdown_0.38                 bit64_4.0.5                  
## [57] magick_2.8.3                  jquerylib_0.1.4              
## [59] ggside_0.3.1                  glue_1.7.0                   
## [61] gtable_0.3.4                  BiocVersion_3.18.1           
## [63] later_1.3.2                   munsell_0.5.0                
## [65] tibble_3.2.1                  pillar_1.9.0                 
## [67] rappdirs_0.3.3                htmltools_0.5.7              
## [69] GenomeInfoDbData_1.2.11       R6_2.5.1                     
## [71] evaluate_0.23                 shiny_1.8.0                  
## [73] lattice_0.22-5                highr_0.10                   
## [75] png_0.1-8                     memoise_2.0.1                
## [77] httpuv_1.6.14                 bslib_0.6.1                  
## [79] Rcpp_1.0.12                   SparseArray_1.2.4            
## [81] xfun_0.42                     pkgconfig_2.0.3