# Visualization

Kevin Stachelek1* and Bhavana Bhat1**

1University of Southern California

*kevin.stachelek@gmail.com
**bbhat@usc.edu

#### 15 April 2025

#### Package

chevreulPlot 1.0.0

This article demonstrates the data visualization tools in Chevreul. We’ll introduce included functions, their usage, and resulting plots

First step is to load chevreulPlot package and all other packages required

    library(chevreulPlot)
    library(scater)
    library(scran)
    library(clustree)
    library(patchwork)

    data("small_example_dataset")

The different plotting functions within chevreulPlot allows for visualization of data, these plots can be customized for interactive or non-interactive display.

# 1 Plot expression

Expression of a feature (genes or transcripts) can be plotted on a given embedding resulting in an interactive feature plot.

When plotting only one feature, output is identical to `SingleCellExperiment::FeaturePlot`

    plot_feature_on_embedding(small_example_dataset,
        embedding = "UMAP",
        features = "Gene_0001", return_plotly = FALSE
    )

An interactive output plot can be generated by specifying `return_plotly = TRUE` which uses `ggplotly` allowing identification of individual cells for further investigation.

## 1.1 Plot read count or other QC measurements

The `plot_colData_histogram` function displays a histogram of cell read counts colored according to a categorical variable using the argument `fill_by`. Here we can see that read counts for this dataset are distinctly different depending on the sequencing batch

    plot_colData_histogram(small_example_dataset,
        group_by = "sizeFactor",
        fill_by = "Treatment"
    )

## 1.2 Plot metadata variable

Make an interactive scatter plot of a metadata variable, where each point in the plot represents a cell whose position on the plot is given by the cell embedding determined by the dimensional reduction technique by default, “UMAP”. The group argument specifies the colData variable by which to group the cells by, by default, “batch”.

    plot_colData_on_embedding(small_example_dataset,
        group = "gene_snn_res.1",
        embedding = "UMAP"
    )

This function utilizes a SingleCellExperiment function, `DimPlot()`, as sub function which produces the dimensional reduction plot. The interactive parameter, `return_plotly`, in plot_colData_on_embedding when set to TRUE will convert the plot into an interactive plot using ggplotly function from R’s plotly package

## 1.3 Plot cluster marker genes

Marker genes of louvain clusters or additional experimental metadata can be plotted using `plot_marker_features`. This allows visualization of n marker features grouped by the metadata of interest. Marker genes are identified using wilcoxon rank-sum test as implemented in `presto`. In the resulting dot plot the size of the dot corresponds to the percentage of cells expressing the feature in each cluster and the color represents the average expression level of the feature.

    plot_marker_features(small_example_dataset,
        group_by = "gene_snn_res.1",
        marker_method = "wilcox"
    )

## 1.4 Plotting transcript composition

`plot_transcript_composition()` plots the proportion of reads of a given gene map to each transcript. The gene of interest is specified by the argument ‘gene_symbol’.

    sessionInfo()
    #> R version 4.5.0 RC (2025-04-04 r88126 ucrt)
    #> Platform: x86_64-w64-mingw32/x64
    #> Running under: Windows Server 2022 x64 (build 20348)
    #>
    #> Matrix products: default
    #>   LAPACK version 3.12.1
    #>
    #> locale:
    #> [1] LC_COLLATE=C
    #> [2] LC_CTYPE=English_United States.utf8
    #> [3] LC_MONETARY=English_United States.utf8
    #> [4] LC_NUMERIC=C
    #> [5] LC_TIME=English_United States.utf8
    #>
    #> time zone: America/New_York
    #> tzcode source: internal
    #>
    #> attached base packages:
    #> [1] stats4    stats     graphics  grDevices utils     datasets  methods
    #> [8] base
    #>
    #> other attached packages:
    #>  [1] patchwork_1.3.0             clustree_0.5.1
    #>  [3] ggraph_2.2.1                scran_1.36.0
    #>  [5] chevreulPlot_1.0.0          chevreulProcess_1.0.0
    #>  [7] scater_1.36.0               ggplot2_3.5.2
    #>  [9] scuttle_1.18.0              SingleCellExperiment_1.30.0
    #> [11] SummarizedExperiment_1.38.0 Biobase_2.68.0
    #> [13] GenomicRanges_1.60.0        GenomeInfoDb_1.44.0
    #> [15] IRanges_2.42.0              S4Vectors_0.46.0
    #> [17] BiocGenerics_0.54.0         generics_0.1.3
    #> [19] MatrixGenerics_1.20.0       matrixStats_1.5.0
    #> [21] BiocStyle_2.36.0
    #>
    #> loaded via a namespace (and not attached):
    #>   [1] batchelor_1.24.0          BiocIO_1.18.0
    #>   [3] bitops_1.0-9              tibble_3.2.1
    #>   [5] polyclip_1.10-7           XML_3.99-0.18
    #>   [7] lifecycle_1.0.4           edgeR_4.6.0
    #>   [9] doParallel_1.0.17         lattice_0.22-7
    #>  [11] ensembldb_2.32.0          MASS_7.3-65
    #>  [13] magrittr_2.0.3            limma_3.64.0
    #>  [15] plotly_4.10.4             sass_0.4.10
    #>  [17] rmarkdown_2.29            jquerylib_0.1.4
    #>  [19] yaml_2.3.10               metapod_1.16.0
    #>  [21] cowplot_1.1.3             DBI_1.2.3
    #>  [23] RColorBrewer_1.1-3        ResidualMatrix_1.18.0
    #>  [25] abind_1.4-8               purrr_1.0.4
    #>  [27] AnnotationFilter_1.32.0   RCurl_1.98-1.17
    #>  [29] tweenr_2.0.3              circlize_0.4.16
    #>  [31] GenomeInfoDbData_1.2.14   ggrepel_0.9.6
    #>  [33] irlba_2.3.5.1             megadepth_1.18.0
    #>  [35] cmdfun_1.0.2              dqrng_0.4.1
    #>  [37] DelayedMatrixStats_1.30.0 codetools_0.2-20
    #>  [39] DelayedArray_0.34.0       ggforce_0.4.2
    #>  [41] tidyselect_1.2.1          shape_1.4.6.1
    #>  [43] UCSC.utils_1.4.0          farver_2.1.2
    #>  [45] wiggleplotr_1.32.0        ScaledMatrix_1.16.0
    #>  [47] viridis_0.6.5             GenomicAlignments_1.44.0
    #>  [49] jsonlite_2.0.0            GetoptLong_1.0.5
    #>  [51] BiocNeighbors_2.2.0       tidygraph_1.3.1
    #>  [53] iterators_1.0.14          foreach_1.5.2
    #>  [55] tools_4.5.0               Rcpp_1.0.14
    #>  [57] glue_1.8.0                gridExtra_2.3
    #>  [59] SparseArray_1.8.0         xfun_0.52
    #>  [61] dplyr_1.1.4               withr_3.0.2
    #>  [63] BiocManager_1.30.25       fastmap_1.2.0
    #>  [65] bluster_1.18.0            digest_0.6.37
    #>  [67] rsvd_1.0.5                R6_2.6.1
    #>  [69] colorspace_2.1-1          RSQLite_2.3.9
    #>  [71] tidyr_1.3.1               data.table_1.17.0
    #>  [73] rtracklayer_1.68.0        graphlayouts_1.2.2
    #>  [75] httr_1.4.7                htmlwidgets_1.6.4
    #>  [77] S4Arrays_1.8.0            pkgconfig_2.0.3
    #>  [79] gtable_0.3.6              blob_1.2.4
    #>  [81] ComplexHeatmap_2.24.0     XVector_0.48.0
    #>  [83] htmltools_0.5.8.1         bookdown_0.43
    #>  [85] ProtGenerics_1.40.0       clue_0.3-66
    #>  [87] scales_1.3.0              png_0.1-8
    #>  [89] knitr_1.50                tzdb_0.5.0
    #>  [91] rjson_0.2.23              curl_6.2.2
    #>  [93] cachem_1.1.0              GlobalOptions_0.1.2
    #>  [95] stringr_1.5.1             parallel_4.5.0
    #>  [97] vipor_0.4.7               AnnotationDbi_1.70.0
    #>  [99] restfulr_0.0.15           pillar_1.10.2
    #> [101] grid_4.5.0                vctrs_0.6.5
    #> [103] BiocSingular_1.24.0       EnsDb.Hsapiens.v86_2.99.0
    #> [105] beachmat_2.24.0           cluster_2.1.8.1
    #> [107] beeswarm_0.4.0            evaluate_1.0.3
    #> [109] readr_2.1.5               GenomicFeatures_1.60.0
    #> [111] cli_3.6.4                 locfit_1.5-9.12
    #> [113] compiler_4.5.0            Rsamtools_2.24.0
    #> [115] rlang_1.1.6               crayon_1.5.3
    #> [117] labeling_0.4.3            forcats_1.0.0
    #> [119] fs_1.6.6                  ggbeeswarm_0.7.2
    #> [121] stringi_1.8.7             viridisLite_0.4.2
    #> [123] BiocParallel_1.42.0       munsell_0.5.1
    #> [125] Biostrings_2.76.0         lazyeval_0.2.2
    #> [127] Matrix_1.7-3              hms_1.1.3
    #> [129] sparseMatrixStats_1.20.0  bit64_4.6.0-1
    #> [131] KEGGREST_1.48.0           statmod_1.5.0
    #> [133] igraph_2.1.4              memoise_2.0.1
    #> [135] bslib_0.9.0               bit_4.6.0