I think you can increase the lower limit of y
by adding scale_y_continuous(limits = c(-1, NA))
.
> library(ggtree)
Bioconductor version 3.12 (BiocManager 1.30.12), ?BiocManager::install for help
ggtree v2.4.2 For help: https://yulab-smu.top/treedata-book/
If you use ggtree in published research, please cite the most appropriate paper(s):
1. Guangchuang Yu. Using ggtree to visualize data on tree-like structures. Current Protocols in Bioinformatics, 2020, 69:e96. doi:10.1002/cpbi.96
2. Guangchuang Yu, Tommy Tsan-Yuk Lam, Huachen Zhu, Yi Guan. Two methods for mapping and visualizing associated data on phylogeny using ggtree. Molecular Biology and Evolution 2018, 35(12):3041-3043. doi:10.1093
/molbev/msy194
3. Guangchuang Yu, David Smith, Huachen Zhu, Yi Guan, Tommy Tsan-Yuk Lam. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. Methods in E
cology and Evolution 2017, 8(1):28-36. doi:10.1111/2041-210X.12628
> library(treeio)
treeio v1.15.7 For help: https://yulab-smu.top/treedata-book/
If you use treeio in published research, please cite:
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. doi: 10.1093/molbev/msz240
> beast_file <- system.file("examples/MCC_FluA_H3.tree", package="ggtree")
> beast_tree <- read.beast(beast_file)
>
> genotype_file <- system.file("examples/Genotype.txt", package="ggtree")
> genotype <- read.table(genotype_file, sep="\t", stringsAsFactor=F)
> colnames(genotype) <- sub("\\.$", "", colnames(genotype))
> p <- ggtree(beast_tree, mrsd="2013-01-01") +
geom_treescale(x=2008, y=1, offset=2) +
geom_tiplab(size=2)
> p
> p1 <- gheatmap(p, genotype, offset=5, width=0.5, font.size=3,
colnames_angle=-45, hjust=0) +
scale_fill_manual(breaks=c("HuH3N2", "pdm", "trig"),
values=c("steelblue", "firebrick", "darkgreen"), name="genotype")
> p1 + ggplot2::scale_y_continuous(limit=c(-1, NA))