Once you identify an interesting view, how can you share it with others? First, you could press the Escape key to freeze the view, so that it doesn’t respond to any other mouse interactions. From there, you could always take a screenshot, but if you want to preserve more details (or add some notes within the figure itself), you could instead export it to a Scalable Graphics (SVG), as discussed in this vignette. For this to work, you will need to use Google Chrome and install the bookmarklet SVG Crowbar 2. We’ll illustrate the process using the simple randomly generatred tree below.
library(ape)
library(phylobar)
tree <- rtree(20)
samples <- matrix(rpois(100 * 20, 1), 100, 20)
phylobar(samples, tree, width=800)
Once you have the bookmarklet installed, you can press it to download any of the phylobar figures in a Quarto or Rmarkdown notebook. In the recording below, we pressed Escape after painting the blue subtree. Then we could move to our bookmarks bar without changing the view. Clicking the bookmarklet brings up a “SVG # (Download)” button that you can click, and the associated graphic will appear in your Downloads folder. Note that you can scroll down to other phylobar visualizations and you would see other buttons for downloading those plots.
The downloaded file is an ordinary SVG, which means it can be edited in any image editor designed for vector graphics. For example, in the recording below, we open the downloaded figure using Inkscape, a free and open source vector graphics editor. Notice that the components of the phylobar plot are already organized into layers.. For example, there is a layer for the barplot, sublayers for each sample, and a final sublayer for the taxa within the samples. This layer structure reflects the original DOM structure created by the D3 visualization code. The recording below shows how we can navigate this layer structure within Inkscape.
From here, we could edit if we want (e.g., to add a comment about an interesting pattern). We are then able to export into other formats that might be more accessible to others, e.g., one that we can embed in slides or add to a word document. In the recording below, we use the layer structure shown in the previous snippet to modify the green subtree so that it uses dashed (rather than solid) lines to link the nodes. Once we have our final version, we export the graphic to PNG format.
sessionInfo()
#> R version 4.6.0 RC (2026-04-17 r89917)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.4 LTS
#>
#> Matrix products: default
#> BLAS: /home/biocbuild/bbs-3.23-bioc/R/lib/libRblas.so
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 LAPACK version 3.12.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] DESeq2_1.51.7 SummarizedExperiment_1.41.1
#> [3] Biobase_2.71.0 MatrixGenerics_1.23.0
#> [5] matrixStats_1.5.0 GenomicRanges_1.63.2
#> [7] Seqinfo_1.1.0 IRanges_2.45.0
#> [9] S4Vectors_0.49.2 BiocGenerics_0.57.1
#> [11] generics_0.1.4 zen4R_0.10.5
#> [13] seriation_1.5.8 tidyr_1.3.2
#> [15] tibble_3.3.1 readr_2.2.0
#> [17] dplyr_1.2.1 microbiome_1.33.0
#> [19] ggplot2_4.0.3 phyloseq_1.55.2
#> [21] phylobar_0.99.9 ape_5.8-1
#> [23] BiocStyle_2.39.0
#>
#> loaded via a namespace (and not attached):
#> [1] phangorn_2.12.1 permute_0.9-10 rlang_1.2.0
#> [4] magrittr_2.0.5 ade4_1.7-24 otel_0.2.0
#> [7] compiler_4.6.0 mgcv_1.9-4 vctrs_0.7.3
#> [10] reshape2_1.4.5 quadprog_1.5-8 stringr_1.6.0
#> [13] pkgconfig_2.0.3 crayon_1.5.3 fastmap_1.2.0
#> [16] XVector_0.51.0 ca_0.71.1 utf8_1.2.6
#> [19] rmarkdown_2.31 tzdb_0.5.0 bit_4.6.0
#> [22] purrr_1.2.2 xfun_0.57 cachem_1.1.0
#> [25] jsonlite_2.0.0 biomformat_1.39.17 DelayedArray_0.37.1
#> [28] BiocParallel_1.45.0 parallel_4.6.0 cluster_2.1.8.2
#> [31] R6_2.6.1 bslib_0.10.0 stringi_1.8.7
#> [34] RColorBrewer_1.1-3 jquerylib_0.1.4 Rcpp_1.1.1-1.1
#> [37] bookdown_0.46 iterators_1.0.14 knitr_1.51
#> [40] Matrix_1.7-5 splines_4.6.0 igraph_2.3.0
#> [43] tidyselect_1.2.1 dichromat_2.0-0.1 abind_1.4-8
#> [46] yaml_2.3.12 vegan_2.7-3 TSP_1.2.7
#> [49] codetools_0.2-20 curl_7.1.0 lattice_0.22-9
#> [52] plyr_1.8.9 withr_3.0.2 S7_0.2.2
#> [55] evaluate_1.0.5 Rtsne_0.17 survival_3.8-6
#> [58] xml2_1.5.2 Biostrings_2.79.5 pillar_1.11.1
#> [61] BiocManager_1.30.27 foreach_1.5.2 vroom_1.7.1
#> [64] hms_1.1.4 scales_1.4.0 glue_1.8.1
#> [67] tools_4.6.0 data.table_1.18.2.1 locfit_1.5-9.12
#> [70] registry_0.5-1 XML_3.99-0.23 fastmatch_1.1-8
#> [73] grid_4.6.0 nlme_3.1-169 cli_3.6.6
#> [76] S4Arrays_1.11.1 keyring_1.4.1 gtable_0.3.6
#> [79] sass_0.4.10 digest_0.6.39 SparseArray_1.11.13
#> [82] htmlwidgets_1.6.4 farver_2.1.2 htmltools_0.5.9
#> [85] multtest_2.67.0 lifecycle_1.0.5 httr_1.4.8
#> [88] bit64_4.8.0 MASS_7.3-65