Have a personal or library account? Click to login
GAPR: An Efficient R Package for Matrix Visualization and Seriation Cover

GAPR: An Efficient R Package for Matrix Visualization and Seriation

Open Access
|Mar 2026

Figures & Tables

Figure 1

GAPR visualization layout applied to the SAPSSANS dataset using the original (unsorted) data order. The proximity measures used in this example are Pearson correlation for variables and Euclidean distance for samples. (a) Data matrix, (b) row-wise proximity matrix, (c) column-wise proximity matrix, (d) Yd covariate annotation with the user-defined color palette, and (e) Xd covariate annotation with the Set1 palette.

Figure 2

Matrix layout after applying R2E seriation to the SAPSSANS dataset for both variables and samples. The figure shows clearer block structures compared to the original layout shown in Figure 1.

Figure 3

Built-in color palettes provided by the GAPR package, their spectrum types, and the parameters they are typically used with. 2grayscale palette is a continuous grayscale gradient for binary data, with white = 0 and black = 1.

Figure 4

Matrix layout after applying the AVG-R2E seriation method to the SAPSSANS dataset. (a) Column-wise proximity matrix and (b) row-wise proximity matrix, shown as magnified views of selected regions. (c) Complete layout of GAP. Compared to the standard R2E result in Figure 2, this layout refines the ordering by subtree flipping.

Table 1

Runtime comparison between GAPR’s C++-based R2E implementation and the R-based version in the seriation package. Benchmarks are conducted using datasets constructed by vertically replicating the iris dataset to create matrices with 600, 1,500, and 10,000 rows, respectively. Both methods yield identical ordering results.

MATRIX SIZEMETHODRUNTIME (SEC)
600 × 600GAPR::ellipse sort()0.14
seriation::R2E1.42
1500 × 1500GAPR::ellipse sort()2.37
seriation::R2E31.21
10000 × 10000GAPR::ellipse sort()896.45
seriation::R2E84945.01
Table 2

Functional comparison of GAPR and selected R packages. 1Seriation package provides HCT-based ordering but does not expose full tree structure for further use. 2These packages provide heatmap-based visualization for a single matrix but do not support an integrated GAP visualization framework with proximity matrices, dendrograms, and covariates.

FEATURE/CAPABILITYGAPRseriationhclust()corrplotpheatmapComplexHeatmap
R2E implementationYes (C++)Yes (R)NoNoNoNo
HCTYes (C++)Partial1Yes (C)YesYesYes
Flipping supportYesNoNoNoNoNo
Integrated visualizationYesNoNoPartial2Partial2Partial2
Table 3

Anti-Robinson metrics comparing R2E and AVG-R2E on sample ordering using the SAPSSANS dataset.

ORDERING METHODARGAR(w = 5)RGAR
R2E621278310.224
AVG-R2E684666090.247
seriation::OLO Average844844780.305
seriation::TSP1143884350.413
Figure 5

Comparison of generalized anti-Robinson (GAR) loss scores across different seriation methods shown in Table 3. The results indicate that R2E consistently achieves lower GAR scores across increasing window sizes for global structure.

Figure 6

Comparison of relative generalized anti-Robinson (RGAR) loss scores across different seriation methods as demonstrated in Table 3. The R2E method consistently achieves the lowest RGAR scores as w increases.

Figure 7

Matrix layout after applying the AVG-R2E seriation method to the Wine Quality dataset. (a) Column-wise proximity matrix and (b) row-wise proximity matrix, shown as magnified views of selected regions. (c) Complete layout of GAP.

Table 4

Runtime (sec) comparison of original, Average-linkage, R2E, and AVG-R2E ordering methods under different iris dataset sizes.

ORDERING METHODiris (150 × 4)REPLICATED iris (32,000 × 4)
Original0.632585.14
Average-linkage0.749458.29
R2E0.6428461.25
AVG-R2E0.7534947.29
DOI: https://doi.org/10.5334/jors.669 | Journal eISSN: 2049-9647
Language: English
Submitted on: Jan 5, 2026
|
Accepted on: Mar 16, 2026
|
Published on: Mar 30, 2026
Published by: Ubiquity Press
In partnership with: Paradigm Publishing Services
Publication frequency: 1 issue per year

© 2026 Shu-Yu Lin, Chun-Houh Chen, Chiun-How Kao, published by Ubiquity Press
This work is licensed under the Creative Commons Attribution 4.0 License.