Created
March 22, 2016 15:00
-
-
Save timcdlucas/781a9c2d03eb144748fa to your computer and use it in GitHub Desktop.
colourstrips in ggtree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t <- read.nexus('data/Chapter3/fritz2009geographical.tre') | |
tr1 <- t[[1]] | |
mat <- data.frame(name = tr1$tip.label) | |
mat$col1 = 'a' | |
mat$col1[1:300] <- 'b' | |
mat$col2 = 'a' | |
mat$col2[200:300] <- 'b' | |
mat$col2[300:500] <- 'c' | |
rownames(mat) <- tr1$tip.label | |
vec <- mat[,2] | |
p <- ggtree(tr1) | |
gheatmap(p, mat[, 2:3], width = 0.03, offset = -1, high = 'red', low = 'blue', colnames = FALSE, color = '00000000') | |
ggsave('~/Desktop/bars.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment