-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
annotation of circular trees #78
Comments
pls follow the guide and provide minimal reproducible example, thanks. |
In my example I used your tree from the tree annotation documentation. I added the library and import information. Is anything further needed? |
1). I can't reproduce your issue:
4). This is not an issue of
|
what's your ggplot2 version? |
ggplot2 version 2.1.0 |
I don't have Windows machine and can't reproduce your issue in either Linux or OSX. BTW: issue 2 & 3 were fixed in ggtree (version >= 1.5.15). |
Thanks, I am doing that. I just hoped for a possibility to separate the legends of the two circles. |
Hi, I tried to install the ggtree (version >= 1.5.15) with Downloading GitHub repo GuangchuangYu/ggtree@master from URL ..... When I try to use ggtree (ggtree(tree, layout = "circular")) it gives Error in layer(data = data, mapping = mapping, stat = Do I have to install it in a differnt way? Thanks Am 10.10.2016 um 15:12 schrieb Guangchuang Yu:
|
You need to install github version of ggplot2 by: install_github("hadley/ggplot2") |
Thanks. With this version issue 1 also works fine. |
library("ggplot2")
library("ggtree")
nwk <- system.file("extdata", "sample.nwk", package="treeio")
tree <- read.tree(nwk)
circ <- ggtree(tree, layout = "circular")
df <- data.frame(first=c("a", "b", "a", "c", "d", "d", "a", "b", "e", "e", "f", "c", "f"),
second= c("z", "z", "z", "z", "y", "y", "y", "y", "x", "x", "x", "a", "a"))
rownames(df) <- tree$tip.label
p1 <- gheatmap(circ, df[, "first", drop=F], offset=.8, width=.1,
colnames_angle=90, colnames_offset_y = .25)
p2 <- gheatmap(p1, df[, "second", drop=F], offset=5, width=.1,
colnames_angle=90, colnames_offset_y = .25)
require(RColorBrewer)
col <- c(brewer.pal(5, "Dark2"), brewer.pal(4, "Pastel1"))
names(col) = c(letters[1:6], letters[24:26])
pp <- p2 + scale_fill_manual(values=col)
p1x <- p1 + scale_fill_manual(values=col)
p2x <- gheatmap(circ, df[, "second", drop=F], offset=5, width=.1) +
scale_fill_manual(values=col)
require(cowplot)
leg1 <- get_legend(p1x)
leg2 <- get_legend(p2x)
pp <- pp + theme(legend.position="none")
plot_grid(pp, leg1, leg2, ncol=3, rel_widths=c(1, .1, .1)) |
Hi @GuangchuangYu, This is a really great example. I am trying to adapt the strategy you used to make a similar plot with two gheatmaps on the outside of a ggtree, but I'd like the data in the gheatmaps to be continuous rather than discrete (numerical values from biological assays). Is there a way to do this? It would be ideal to have multiple heatmaps with different gradient color scales. I have the data arranged in a dataframe, where rows are samples and each column holds numerical data for each sample's performance in a bioassay. I try to use the built in I've tried looking through the issues on github and performed many string searches online, but haven't really found any solution yet. Any advice, suggestions or guidance would be really appreciated. Thanks for making this really great package! UPDATE: I saw that there is a google forum for this package, so I have posted the same question there. Here is the link |
Hi,
Thank you in advance for your suggestions! |
pls refer to the ggtreeExtra package for circular tree annotation. |
Hi, thanks for the nice package, I like to use it for circular trees. However, I have some issues annotating circular trees (using ggtree version 1.4.20).
I want to show aligned tip labels with geom_tip2 but the nodes are always shown too.
load tree from tree annotation documentation:
library("ggplot2")
library("ggtree")
nwk <- system.file("extdata", "sample.nwk", package="ggtree")
tree <- read.tree(nwk)
circ <- ggtree(tree, layout = "circular")
without align:
circ + geom_tiplab2(size=2.5, color="black")
with align:
circ + geom_tiplab2(size=2.5, color="black", align=TRUE)
How do I prevent that the nodes are shown? I also tested it with subset:
circ + geom_tiplab2(size=2.5, aes(subset=isTip), color="black", align=TRUE)
but that did not work either.
Increase resolution of circular tree after a node was collapsed
At the moment the space of a collapsed clade remains empty in the circle:
circ %>% collapse(node=21) + geom_point2(aes(subset=(node == 21)), size=5, shape=23, fill="steelblue")
Is it possible circularise the tree again (extend a circular tree over the whole circle) after a clade was collapsed? At the moment I drop the tips in the original phylo object and draw the resulting tree from scratch but this is rather laborious.
Adapt angle of tip labels after rotate
The angle of aligned tip labels seem to refer to the original position (see example below).
generate long tip names:
circ$data$label <- c(paste(circ$data$label[1:13], "aaaa", sep=""), circ$data$label[14:length(circ$data$label)])
tip label orientation before rotate:
circ + geom_tiplab(size=2.5, color="black", align=TRUE, aes(angle=angle))
tip label orientation after rotate:
rotate(circ, 16) + geom_tiplab(size=2.5, color="black", align=TRUE, aes(angle=angle))
Is it possible to angle the tip labels according to the new position preferable with geom_tiplab2?
Add two independently coloured heatmaps with separate legends with gheatmap to a circular tree
I would like to do something like the following:
external data which should be added:
df <- data.frame(first=c("a", "b", "a", "c", "d", "d", "a", "b", "e", "e", "f", "c", "f"), second= c("z", "z", "z", "z", "y", "y", "y", "y", "x", "x", "x", "a", "a")) row.names(df) <- circ$data[circ$data$isTip=="TRUE", "label"]
first heatmap with manual colour palette:
library("RColorBrewer") p1 <- gheatmap(circ, df[,"first", drop=FALSE], offset = 0.8, width=0.1) + scale_fill_brewer(palette= "Dark2") p1
add second heatmap with another colour palette:
gheatmap(p1, df[,"second", drop=FALSE], offset = 5, width=0.1) + scale_fill_brewer(palette= "Pastel1")
results in the warning:
Both circles are coloured according to the last palette and one legend for all entries is generated. For similar entries (a) this can be confusing. Is it possible to add several independently controllable heatmaps?
Thanks.
The text was updated successfully, but these errors were encountered: