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

Problem with label in "fan" plots #106

Closed
AEgit opened this issue Dec 8, 2016 · 3 comments
Closed

Problem with label in "fan" plots #106

AEgit opened this issue Dec 8, 2016 · 3 comments

Comments

@AEgit
Copy link

AEgit commented Dec 8, 2016

Hi,

I've a problem with the label parameter when using "fan" plots. Consider the following minimum example:

myplot <- ggtree(mytree, branch.length="none")
myplot <- myplot %<+% edge +
  geom_tiplab(size=3, label = sub("_", " ", myplot$data$label[which(myplot$data$isTip == TRUE)]), fontface="italic")
myplot

This gives a nice normal phylogram. Note, that I replace underscores in my tips with space.

Now let's use the exact same code, but adapted for a tree with "fan" layout.

myfanplot <- ggtree(mytree, layout="fan", branch.length="none")
myfanplot <- myfanplot %<+% edge +
  geom_tiplab2(size=3, label = sub("_", " ", myfanplot$data$label[which(myfanplot$data$isTip == TRUE)]), fontface="italic")
myfanplot

This results in the following error:
Error: Aesthetics must be either length 1 or the same as the data (75): label, size, hjust, fontface

If I use the same "fan" code without the label parameter everything works fine:

myfanplot <- ggtree(mytree, layout="fan", branch.length="none")
myfanplot <- myfanplot %<+% edge +
  geom_tiplab2(size=3, fontface="italic")
myfanplot

Can you confirm this issue? I'm using version 1.6.4 of ggtree.

@GuangchuangYu
Copy link
Member

GuangchuangYu commented Dec 9, 2016

@AEgit
Copy link
Author

AEgit commented Dec 9, 2016

Thank you very much - I didn't realize this issue because using "$" did work in the phylogram plot. But I guess I was just lucky that ggtree didn't change the order of the rows for the phylogram plot. Thanks again!

I'll close this.

@AEgit AEgit closed this as completed Dec 9, 2016
@JakoboEU
Copy link

Hi @GuangchuangYu , those links are now dead. Could you please update them?

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

3 participants