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

using aplot to combine ggside and ggtree object #9

Open
xiangpin opened this issue Jun 15, 2023 · 0 comments
Open

using aplot to combine ggside and ggtree object #9

xiangpin opened this issue Jun 15, 2023 · 0 comments
Labels

Comments

@xiangpin
Copy link
Member

the aplot does not support combining the ggplot objects (containing the facet) with the direction of facet.

> library(MicrobiotaProcess)
> library(aplot)
> data(mouse.time.mpse)
> mouse.time.mpse %>% as_tibble() %>% ggplot(aes(x=Sample, y=OTU, fill=Abundance)) + geom_tile() + facet_wrap(~time, scales='free_x') -> p1
> mouse.time.mpse %>% mp_rrarefy() %>% mp_cal_alpha(.abundance = RareAbundance) %>% mp_extract_sample() %>% ggplot(aes(x = Sample, y = Observe, fill = time)) + geom_col() + facet_wrap(~time, scales="free_x") -> p2
> p1 %>% insert_top(p2)

捕获

the ggside can be using to visualize the side panel in the main ggplot with other geom

> da2 <- mouse.time.mpse %>% mp_rrarefy() %>% mp_cal_alpha(.abundance = RareAbundance) %>% mp_extract_sample()
> p2 <- p1 + geom_xsidecol(data = da2, mapping=aes(x=Sample, y=Observe, xfill = time)) + scale_xsidey_continuous()
> p2 

捕获

now, aplot can not combine the ggside and ggtree object, I think if aplot can support combining the ggside and ggtree objects, which will increase the power of aplot.

> mouse.time.mpse %>% mp_cal_dist(.abundance=Abundance, distmethod='bray', cal.feature.dist=T, action='get') %>% hclust() %>% treeio::as.phylo() %>% ggtree::ggtree() -> f1
> p2 %>% insert_left(f1)

捕获

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