In most cases, this is very simple. Just +scale_x_continuous(labels = comma) should work.
In your case, as the labels and breaks are different numbers, you can just add commas in labels.

--
1. G Yu*. Using ggtree to visualize data on tree-like structures. Current Protocols in Bioinformatics. 2020, 69:e96. https://doi.org/10.1002/cpbi.96
2. LG Wang, TTY Lam, S Xu, Z Dai, L Zhou, T Feng, P Guo, CW Dunn, BR Jones, T Bradley, H Zhu, Y Guan, Y Jiang, G Yu*. treeio: an R package for phylogenetic tree input and output with richly annotated and associated data. Molecular Biology and Evolution. 2020, 37(2):599-603. http://dx.doi.org/10.1093/molbev/msz240
3. G Yu*, TTY Lam, H Zhu, Y Guan*. Two methods for mapping and visualizing associated data on phylogeny using ggtree. Molecular Biology and Evolution, 2018, 35(2):3041-3043. https://doi.org/10.1093/molbev/msy194
4. G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data, Methods in Ecology and Evolution, 2017, 8(1):28-36. https://doi.org/10.1111/2041-210X.12628
5. Book: https://yulab-smu.top/treedata-book/
---
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/038e1ec3-8c1f-427c-966e-ecdcd086f1b7n%40googlegroups.com.

set.seed(2020-10-11)
test_tree <- rtree(4)
test_tree$edge.length <- test_tree$edge.length*10000
test_tree <- ggtree(test_tree) + geom_tiplab(size=8) + theme_tree2()
test_tree <- revts(test_tree) +
scale_x_continuous(labels=function(x) scales::comma(abs(x))) # <-- what you need is actually a function.
facet_plot(test_tree, panel = 'Stacked Barplot', data = tdf1_melted, geom = geom_barh,
mapping = aes(x = value, fill = as.factor(variable)), size=10,
width = 1.0, stat='identity')

To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/ac05a365-bbf4-4ebf-a135-2a9001ce9df6n%40googlegroups.com.