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

How to move x axis in heatmap by geom_fruit to top? #630

Open
5 of 8 tasks
SilentGene opened this issue Sep 13, 2024 · 1 comment
Open
5 of 8 tasks

How to move x axis in heatmap by geom_fruit to top? #630

SilentGene opened this issue Sep 13, 2024 · 1 comment

Comments

@SilentGene
Copy link

Prerequisites

  • Have you read Feedback and follow the guide?
    • make sure your are using the latest release version
    • read the documents
    • google your question/issue

Describe you issue

  • Make a reproducible example (e.g. 1)
  • your code should contain comments to describe the problem (e.g. what expected and actually happened?)

Ask in right place

  • for bugs or feature requests, post here (github issue)
  • for questions, please post to google group

Hi Prof. Guangchuang Yu,

Thanks for the amazing tool! I was just wondering when I create a heatmap by geom_fruit, how can I move the x axis to the top instead of at the bottom?

Here is my pseudocode and outcome:

# my tree
x <- rtree(10)
p<-ggtree(x) + geom_tiplab()

# my metadata
metadata <- data.frame(Node = sample(x$tip.label, 10), 
                       Function = sample(c("A", "B", "C"), 10, replace = TRUE), 
                       Value = runif(10))
# visulize
p.test + new_scale_fill() +
  geom_fruit(data = metadata, geom=geom_tile,
             mapping = aes(y=Node, x=Function, fill = Value), 
             offset=0.1, pwidth=0.5,
             axis.params=list(axis="x", text.size=3,hjust=1, text.angle=45, vjust=1)
             )

Now, I get:
image

So my question was how to move the x axis "A, B, C" to the top of the heatmap?

Best Regards,
Heyu

@ShanfenO
Copy link

ShanfenO commented Nov 6, 2024

You can make PS.

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

No branches or pull requests

2 participants