Abstract
Effective data visualization is crucial for researchers, revealing patterns, trends, and insights that might otherwise remain hidden. Integrating related visualizations can reveal correlations and relationships that are not evident when analyzing datasets separately. Despite increasing demand, there is a shortage of general tools to seamlessly combine diverse datasets to create complex visual representations. The aplot package addresses this by allowing users to independently create subplots and assemble them into a cohesive composite figure. It automatically reorders datasets for coordinate consistency, removing the need for manual adjustment. This modular approach simplifies the creation of complex visualizations, allowing customization to meet specific needs. Aplot’s versatility is ideal for integrating multi-omics datasets and analytical results for biological insights. The package is freely available on CRAN at https://cran.r-project.org/package=aplot, offering researchers a powerful tool for enhanced data exploration and visualizing workflows.
Keywords: complex graphs, data visualization, multi-omics integration, gene expression analysis, aplot
Graphical abstract

Public summary
-
•
Seamless with ggplot2, aplot enables unified analysis across multiple data types.
-
•
Aplot excels at multi-omics, integrating genomics, transcriptomics, and proteomics for deeper insights.
-
•
Its modular workflows simplify building complex figures, eliminating manual adjustments in data alignment.
Introduction
In recent years, significant advancements in medical research have been propelled by breakthroughs in molecular-level measurement technologies, particularly within the realm of personalized medicine. The emergence of new technological platforms, such as genomics, transcriptomics, epigenetics, proteomics, and metabolomics, has resulted in the generation of vast amounts of complex data alongside advancements in analytical tools. This signifies a transformative era in scientific research.1 Such data encompass a broad spectrum of methodologies and applications, facilitating an in-depth investigation of the correlations between genetic variation and diseases. The explosive growth of such data necessitates enhancements in analysis and visualization methodologies to effectively address the complexity and diversity in “big data”. Successfully managing and interpreting this information are crucial for deepening our understanding of complex diseases, facilitating the development of precision medicine strategies, and optimizing clinical practices. In particular, the comprehensive analysis of cross-omics data benefits significantly from appropriate multidimensional visualization techniques, which can illuminate underlying patterns, trends, and insights that extend beyond what a single perspective can provide.
Combining visualizations of different yet related data can reveal patterns that may remain concealed when visualized separately. While numerous tools support multi-layered presentations, they are typically tailored to handle a single dataset. For associated visualizations, several R packages, such as ggtree,2 ggtreeExtra,3 complexHeatmap,4 and TOmicsVis,5 offer analysis and visualization capabilities for specific scenarios. These include integrating species data with phylogenetic trees, displaying sample attributes in heatmaps, and providing visual integration solutions for exploring transcriptomic data based on sample characteristics. Collectively, these tools significantly enhance data processing and visualization, rendering bioinformatics analysis more efficient and interpretable. However, they are often domain specific, highlighting a gap for a versatile tool to address a broader range of scenarios and effectively handle heterogeneous data.
Inspired by method 2 implemented in ggtree,6 we developed the aplot package, aiming to simplify the visualization of multi-omics data correlations. This tool facilitates the arrangement of subplots in four directions (top, bottom, left, and right) around the main plot, thereby circumventing the complications associated with inconsistent coordinate axes. This design promotes the creation of intricate visualizations, as each subplot can be independently crafted before integration. A key advantage of aplot compared to other tools is its capacity to automatically reorder data, ensuring consistency during the composition process and minimizing the need for manual adjustment. Consequently, as a robust tool for merging diverse subplots and datasets, aplot broadens the possibilities for data correlation analysis and accommodates a wider spectrum of analytical requirements. Released on CRAN in 2020, it represents the first implementation dedicated to this purpose, to the best of our knowledge.
Constructing composite figures is a widely utilized technique in scientific research, often accomplished by organizing various charts in multiple panels. While tools such as cowplot and patchwork are frequently employed in this domain, maintaining alignment between subplots across datasets poses a significant challenge, often resulting in complex and error-prone data operations. In contrast, aplot is specifically designed to address this issue, enabling the straightforward creation of complex graphics (Figure 1). As illustrated in Figures 2, 3, and 4, aplot can automatically adjust the data order to align the subplots, empowering researchers to explore data associations with greater ease and accuracy.
Figure 1.
Overview of aplot
(A) Composition method based on precise alignment of coordinate axes.
(B) Composition method based on user-specified row and column order, without precise coordinate alignment.
(C) Example of precise alignment between main and subplots with discrete axes.
(D) Example of precise alignment between main and subplots with continuous axes.
Figure 2.
Automatic data alignment and integration with aplot for enhanced visualization
Independent subplots (A–F) used to construct the composite visualization in (G), created without prior consideration of alignment or interrelationships.
(A) Expression heatmap (unclustered) of marker genes.
(B) Hierarchical clustering of marker genes.
(C) Hierarchical clustering of cells.
(D) Cell-type labels.
(E) Degree of each marker gene within the protein-protein interaction network, constructed using the STRING database.
(F) Biological pathways involving marker genes, derived from the C2 collection of the Molecular Signatures Database.
(G) A composite visualization created by integrating the subplots (A)–(F) using the aplot package. Aplot automatically aligns data orders and coordinates across subplots, enabling meaningful associations and revealing relationships that might not be apparent when the plots are analyzed separately.
Figure 3.
Multi-omics data integration using aplot reveals cell-type-specific chromatin organization
Comparative visualization of a topologically associating domain (TAD) region (chr6:43,600,000–44,100,000) containing the VEGFA gene in GM12878 and K562 cell lines. The figure shows vertically integrated genomic tracks for each cell type (left: GM12878, right: K562), including Hi-C contact matrices (top), four histone modification ChIP-seq profiles (H3K27ac, H3K36me3, H3K4me1, and H3K4me3), and gene annotations (bottom). The Hi-C contact matrices display interaction frequencies within the TAD region, with darker colors indicating stronger interactions. The ChIP-seq tracks show the distribution of different histone modifications, reflecting distinct regulatory states. Gene annotations at the bottom indicate the positions of protein-coding genes and non-coding RNAs within this genomic region. This integrated visualization reveals cell-type-specific differences in chromatin organization and epigenetic modifications, particularly highlighting the altered regulatory landscape around the VEGFA gene between GM12878 and K562 cells.
Figure 4.
Interoperable multi-plot assembly via aplot
(A) TCGA pan-cancer mutation-expression covariation: synchronized breast/ovarian patterns.
(B) Cluster analysis of microbial community structures in different samples, combining microbial abundance and diversity composition.
(C) Spatial multi-omics mapping: cell topology with gene/protein co-profiles.
(D) Multidimensional vehicle analytics: funky heatmap of integrated performance metrics.
(E) An UpSet plot of response levels at different time under various experimental treatments.
Materials and methods
Overview of the aplot framework
To facilitate the alignment and manipulation of ggplot objects for constructing complex composite plots, we developed the aplot package. By leveraging the ggplot2 grammar of graphics, aplot extends its capabilities, allowing users to coordinate multiple visualizations with precise control over their spatial alignment. This is particularly beneficial in multi-panel plots, which are commonly used to juxtapose and compare diverse datasets across shared coordinate systems.
Implementation and design
At the core of the aplot framework is a modular workflow that enables the seamless integration of separate ggplot objects into a cohesive, visually coherent layout. The package employs a coordinate-matching algorithm to ensure precise alignment across panels. This alignment is achieved by dynamically extracting and synchronizing plotting scales, axis limits, and geometric transformations from each ggplot object involved in the composite plot.
The structural backbone of aplot is built around functions that extend the base plotting capabilities of ggplot2, enabling users to position and nest plots vertically, horizontally, or in customized grid layouts. Functions such as insert_top(), insert_right(), insert_left(), and insert_bottom() streamline the process of linking individual plots while maintaining fidelity to their respective aesthetic mappings.
Coordinate alignment and composite rendering
The key innovation of aplot lies in its ability to align multiple plots based on shared coordinate systems. To achieve this, the scales parameter and axis limits of each ggplot object are programmatically reconciled. The package provides utility functions to automatically detect common axes (e.g., x axis or y axis) and adjust scales accordingly while also preserving the aspect ratio and thematic integrity of each plot. To ensure the accurate presentation of composite plots, the aplot package internally defines the S3 method grid.draw, which leverages ggplot2’s gtable layout structure. This enables precise control over plot margins, spacing, and alignment while supporting annotation layers in rendering.
Scalability and flexibility
The aplot framework is optimized for scalability, accommodating a wide range of plot types and dataset sizes. It supports the integration of complex panels containing heatmaps, scatterplots, barplots, or other visual elements created in ggplot2 or ggplot2-extention packages. Advanced users can also manipulate plots programmatically to include auxiliary annotations or external graphical elements.
Results
Overview of the aplot package: Comprehensive functionality for data visualization
The aplot package is a powerful suite of graphics processing tools designed to enhance data visualization capabilities (Table 1). Its primary functionality lies in the integration of various graphs, which can be categorized into two types: (1) the combination of a main plot with additional subplots positioned according to user specifications (Figure 1A) and (2) the systematic arrangement of plots in sequential rows and columns (Figure 1B). For the first type of combination, the aplot package offers insert_∗() functions, which can manipulate subplots to match their coordinates and insert charts into the left, right, top, or bottom of the main plot. Matching the coordinates allows information to be associated, thereby enriching the information hierarchy and ensuring a clear and orderly layout (Figures 1C and 1D). For the second type of combination, the aplot package provides the plot_list() function, a versatile plotting tool that facilitates the seamless creation of a series of graphics. This function empowers users to customize layouts and fine-tune elements with considerable flexibility.
Table 1.
Major aplot functions
| Function | Description |
|---|---|
| as.patchwork | convert an object into a patchwork object |
| gglist | constructor for gglist object |
| gglistGrob | convert gglist object to grob object |
| ggrange | wrapper function for xrange and yrange |
| insert_left | insert a plot to the left of the main plot |
| insert_right | insert a plot to the right of the main plot |
| insert_top | insert a plot to the top of the main plot |
| insert_bottom | insert a plot to the bottom of the main plot |
| plot_list | draw a series of graphic objects, layout and elements can be set, and the combined drawing can be returned in two formats: gglist or patchwork |
| xlab2 | display the x axis label as ordinary text |
| ylab2 | display the y axis label as ordinary text |
| xlim2 | set the y axis range of the current graphic object based on another graphic object |
| ylim2 | set the x axis range of the current graphic object based on another graphic object |
| xrange | obtain the x axis range |
| yrange | obtain the y axis range |
This comprehensive collection of functionalities within the aplot package establishes a robust platform for composite graphic creation, empowering researchers to produce sophisticated and intuitive data visualizations. Through precise control of graphical elements, aplot facilitates effective communication and in-depth interpretation of complex information.
Leveraging aplot for multifaceted gene expression analysis
Single-cell analysis has emerged as a crucial tool in functional genomics, with widespread applications in disease research. In single-cell transcriptomic analysis, key steps include cell clustering, identification of marker genes, and cell-type annotation. Typically, these components are visualized collectively, often relying on existing tools that may limit the integration of additional information.
In this context, we illustrate the design concept of aplot. Initially, we independently generated visualizations for various aspects: gene expression levels (Figure 2A), clustering results for genes and samples (Figures 2B and 2C), cell-type annotations (Figure 2D), the degree of marker genes in interaction networks constructed from the STRING7 database (Figure 2E), and biological pathways involving these marker genes from the Molecular Signatures Databases C2 collection8 (Figure 2F). Each plot was created independently without the need to consider relationships between datasets, simplifying the figure generation process. Once these plots are handed over to aplot for assembly, it automatically matches the data across plots (Figure 2G). This capability simplifies the creation of complex association plots, seamlessly integrating marker gene expression, cell-type annotations, and additional data types.
This mechanism enables users to associate and visualize data from diverse types and sources according to their specific needs, facilitating the exploration and identification of relationships and patterns within complex datasets.
Multi-omics data integration with aplot for chromatin organization analysis
The integration and visualization of multi-omics data are essential for understanding the complex relationships between chromatin organization and gene regulation. Here, we demonstrate how aplot can effectively combine and display various genomic data tracks, including high-throughput sequencing and chromosome conformation capture (Hi-C) interaction maps, multiple histone modification chromatin immunoprecipitation sequencing (ChIP-seq) profiles, and gene annotations, to reveal cell-type-specific regulatory features.
Using aplot, we constructed a comprehensive visualization comparing chromatin organization between GM12878 and K562 cell lines9 (Figure 3). This integrated display reveals striking differences in chromatin architecture and epigenetic landscapes, particularly in the region containing the VEGFA gene—a critical regulator of tumor angiogenesis. The visualization clearly demonstrates enhanced chromatin interactions and substantially elevated histone modification signals in K562 cells, with notably increased H3K27ac and H3K4me1 levels marking active enhancer regions. The precise vertical alignment of Hi-C contact matrices with histone modification tracks and gene annotations enables direct observation of spatial relationships between regulatory elements and their target genes.10 This is particularly evident in the K562 cells, where regions with intense H3K27ac enrichment appear to form spatial contacts with the VEGFA gene locus, suggesting the presence of cell-type-specific super-enhancers that may drive VEGFA expression through three-dimensional chromatin interactions that would be impossible to detect without this integrated visualization approach.
Broad applicability of aplot in multi-omics visualization
We demonstrate aplot’s versatility through its ability to unify diverse visualization paradigms across biological and engineering domains. Each subplot in Figure 4 exemplifies how aplot’s grammar-driven composability addresses distinct analytical challenges.
For pan-cancer studies (Figure 4A), the integrated analysis of synchronized mutation spectra and expression profiles reveals relationships between genetic alterations and transcriptional activity, enabled by aplot’s genomic coordinate matching across oncoplots and ridge plots. In microbiome research, precise matching of microbial community structural differences, community abundance, and species diversity across samples using aplot enables intuitive visualization of the relationships between different characteristics11 (Figure 4B). Spatial multi-omics mapping (Figure 4C) achieves sub-micron precision by aligning Visium spatial transcriptomics with proteomic gradients, dynamically linking immune cell niches to molecular signatures. Figure 4D presents a vehicle performance funky heatmap generated by aplot, integrating 10 metrics across 32 car models, enabling rapid pattern recognition through color-coded normalization to reveal engineering trade-offs and correlations between different performance parameters. Finally, aplot can also be used for UpSet visualization, providing an intuitive and clear exploration of intersection patterns among multiple sets in high-dimensional data (Figure 4E). By unifying biological and engineering visualization under a single grammar, aplot transcends domain-specific tools to empower hypothesis-driven exploration of complex systems.
Discussion
Here, we present a versatile and innovative data visualization tool, the aplot package. This package facilitates the visualization of associations between the main plot and subplots through flexible layouts, enabling users to establish intuitive connections between different datasets without the complexity associated with coordinate axis matching. The key innovation of the aplot package is its ability to automatically handle data reordering, significantly simplifying the construction process of composite figures and rendering data correlation visualization straightforward and intuitive. This functionality substantially broadens the possibilities for data correlation visualization, assisting researchers in uncovering new insights and patterns within their data.
Complex composite plots can be decomposed into simple combinations of subplots, such as oncoplots for visualizing mutation data and upset plots for displaying set intersections.12,13 With aplot, these visualization methods can be easily reproduced, and users have the flexibility to delete, replace, or add components as needed. For instance, after creating an oncoplot to display mutation types within samples, a ridgeline plot can be appended to illustrate the expression distribution of corresponding or adjacent genes, as demonstrated in Figure 4A. Such associations can elucidate how mutations impact gene expression. In an UpSet plot, intersections can be represented not only with barplots to indicate counts but also with alternative visualizations that emphasize their characteristics. For example, gene intersections can be depicted using a dotplot to illustrate the biological pathways involved14 or a violin plot to represent expression levels.15 This approach aids in identifying distinctive features within the intersections of different sets (Figure 4E). The aplot package greatly simplifies this type of data exploration. Additionally, we have developed the aplotExtra package, which leverages aplot to create oncoplots, UpSet plots, and funky heatmaps. Furthermore, aplot has been integrated into several R packages for constructing complex graphics, including scDotPlot for single-cell RNA sequencing (scRNA-seq) dot plots, sitePath for sequence clustering with site polymorphism, enrichplot16 and GseaVis for gene set enrichment visualization, and ggheatmap for visualizing heatmaps with annotations.
The construction of complex figures through the assembly of independent subplots greatly enhances the comprehensive presentation of multi-omics data. In addition to integrating genomic, transcriptomic, and proteomic data, aplot allows for the visualization of specific epigenetic profiles of different cell types at designated loci using single-cell assay for transposase-accessible chromatin sequencing (scATAC-seq) data, and it associates these features with gene expression quantified in scRNA-seq. The development of this tool effectively addresses the growing demand for a deeper understanding of disease mechanisms within the realm of multi-omics research.
In conclusion, the aplot package offers a modular approach that enables users to freely combine different subplots, thereby simplifying the creation process of complex graphics. This flexibility not only enhances the depth of data exploration but also aids researchers in uncovering associations between datasets, facilitating the identification and comprehension of systemic patterns.
Resource availability
Materials availability
This study did not generate new unique materials/reagents.
Data and code availability
All datasets used in this study are publicly available. Hi-C data were obtained from GSE63525. ChIP-seq data for histone modifications were obtained from GSE29611. Spatial data of the mouse spleen were obtained from GSE198353. The source code and binary package of aplot are available at https://cran.r-project.org/package=aplot (Artistic-2.0 license). The documentation, including the code to reproduce Figures 2 and 3, is available at https://yulab-smu.top/aplot.
Funding and acknowledgments
This study was supported by the National Natural Science Foundation of China (no. 32270677).
Author contributions
G.Y. supervised the project, developed the package and wrote the original draft. S. X., Q. W., S. W., J. L. and N. H. wrote the main manuscript and discussed data analysis. S. X. M. L., C. G., and T. H. contributed to the development of the package. Q. W., R. W., D. Z., S. W., S. L. and L. Z. analyzed data and interpreted results. S. X., S. W., S. T., Z. X. and L. D. reviewed the codes. All authors contributed to and approved the manuscript.
Declaration of interests
The authors declare no competing interests.
Published Online: May 22, 2025
References
- 1.Gomes B., Ashley E.A. Artificial Intelligence in Molecular Medicine. N. Engl. J. Med. 2023;388:2456–2465. doi: 10.1056/NEJMra2204787. [DOI] [PubMed] [Google Scholar]
- 2.Yu G. Using ggtree to Visualize Data on Tree-Like Structures. Curr. Protoc. Bioinformat. 2020;69 doi: 10.1002/cpbi.96. [DOI] [PubMed] [Google Scholar]
- 3.Xu S., Dai Z., Guo P., et al. ggtreeExtra: Compact Visualization of Richly Annotated Phylogenetic Data. Mol. Biol. Evol. 2021;38:4039–4042. doi: 10.1093/molbev/msab166. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4.Gu Z. Complex heatmap visualization. iMeta. 2022;1 doi: 10.1002/imt2.43. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5.Miao B.-B., Dong W., Han Z.-F., et al. TOmicsVis: An all-in-one transcriptomic analysis and visualization R package with Shinyapp interface. iMeta. 2023;2 doi: 10.1002/imt2.137. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6.Yu G., Lam T.T.-Y., Zhu H., et al. Two Methods for Mapping and Visualizing Associated Data on Phylogeny Using Ggtree. Mol. Biol. Evol. 2018;35:3041–3043. doi: 10.1093/molbev/msy194. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7.Szklarczyk D., Nastou K., Koutrouli M., et al. The STRING database in 2025: protein networks with directionality of regulation. Nucleic Acids Res. 2025;53:D730–D737. doi: 10.1093/nar/gkae1113. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Liberzon A., Subramanian A., Pinchback R., et al. Molecular signatures database (MSigDB) 3.0. Bioinformatics. 2011;27:1739–1740. doi: 10.1093/bioinformatics/btr260. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Hua D., Gu M., Zhang X., et al. DiffDomain enables identification of structurally reorganized topologically associating domains. Nat. Commun. 2024;15:502. doi: 10.1038/s41467-024-44782-6. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Wang Q., Li M., Wu T., et al. Exploring Epigenomic Datasets by ChIPseeker. Current Protocols. 2022;2 doi: 10.1002/cpz1.585. [DOI] [PubMed] [Google Scholar]
- 11.Xu S., Zhan L., Tang W., et al. MicrobiotaProcess: A comprehensive R package for deep mining microbiome. Innovation. 2023;4 doi: 10.1016/j.xinn.2023.100388. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Mayakonda A., Lin D.-C., Assenov Y., et al. Maftools: efficient and comprehensive analysis of somatic variants in cancer. Genome Res. 2018;28:1747–1756. doi: 10.1101/gr.239244.118. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.Conway J.R., Lex A., Gehlenborg N. UpSetR: an R package for the visualization of intersecting sets and their properties. Bioinformatics. 2017;33:2938–2940. doi: 10.1093/bioinformatics/btx364. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Xu S., Hu E., Cai Y., et al. Using clusterProfiler to characterize multiomics data. Nat. Protoc. 2024;19:3292–3320. doi: 10.1038/s41596-024-01020-z. [DOI] [PubMed] [Google Scholar]
- 15.Wu T., Hu E., Xu S., et al. clusterProfiler 4.0: A universal enrichment tool for interpreting omics data. Innovation. 2021;2 doi: 10.1016/j.xinn.2021.100141. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 16.Yu G. Thirteen years of clusterProfiler. Innovation. 2024;5 doi: 10.1016/j.xinn.2024.100722. [DOI] [PMC free article] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
All datasets used in this study are publicly available. Hi-C data were obtained from GSE63525. ChIP-seq data for histone modifications were obtained from GSE29611. Spatial data of the mouse spleen were obtained from GSE198353. The source code and binary package of aplot are available at https://cran.r-project.org/package=aplot (Artistic-2.0 license). The documentation, including the code to reproduce Figures 2 and 3, is available at https://yulab-smu.top/aplot.




