Skip to content
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

Bug in gplot.heatmap #3

Closed
mworkentine opened this issue Feb 11, 2015 · 3 comments
Closed

Bug in gplot.heatmap #3

mworkentine opened this issue Feb 11, 2015 · 3 comments
Labels

Comments

@mworkentine
Copy link

Nice package! I've been looking for something like this for a while. Noticed a bug in gplot.heatmap where the levels of the heatmap aren't reordered properly and the labels don't match up with their respective values in the heatmap.

This line in gplot.heatmap simply reorders the label:

levels(dd$Var1) <- df$label[order(df$y)]

This correctly reorders the levels:

dd$Var1 <- factor(dd$Var1, levels = df$label[order(df$y)])

Also, for very large heatmaps the tree and heatmap don't line up properly. It would be nice to see if this could be fixed because now it requires manually playing with the plot margins until it looks good.

Example:

t = rtree(1000)
data = as.data.frame(replicate(4, rnorm(1000)))
row.names(data) = t$tip.label
gplot(ggtree(t),data)
@GuangchuangYu
Copy link
Member

Good catch and thanks for your report. The reorder issue has been removed in ggtree (version >=0.99.18).

For the line up issue, since that can't be supported internally in current version of ggplot2 (please refer to the Linked micromaps section in ggplot2's wishlist feature requests), gplot will output a list of ggplot2 objects and user can manual adjust them if they can't be aligned properly.

Of course, I will explore some possibilities to align them more accurately.

@mworkentine
Copy link
Author

Thanks for the quick fix!

As for the alignment issue I did find that adding scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) to the tree plot allowed for better alignment.

@GuangchuangYu
Copy link
Member

In devel branch, I have created another function called gheatmap, will will always line up the heatmap to the tree properly.

please refer to the new vignette: http://www.bioconductor.org/packages/3.2/bioc/vignettes/ggtree/inst/doc/ggtree.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants