-
Notifications
You must be signed in to change notification settings - Fork 31
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
question: What makes a ribbon to cross over other ribbons in sankey plot ? #37
Comments
Hey Valentin, I am in a very similar situation, did you find a solution for this? |
Hello @giacomomutti , I could not figure out how to make it. bests. |
Your nodes have a character names, so standard ggplot behaviour is to display these as categories in alphabetical order. If you notice at each x coordinate (or column if you prefer to think about it that way), the nodes are in alphabetical order (with A at the bottom to Z at the top, but with capital letters coming before lower case equivalents if we look at the order of TMED25 before Thioglobaceae). This ordering determines the node locations, which causes the overlaps to happen. To control the order of character labels, you can convert However, I'm finding factors can mess up the sankey label positioning, which is why I'm browsing the issue board in the first place. |
I solved this issue by converting the First you need to arrange your dataset for all the columns you are interested in. Then you get the levels of all the columns and apply the same ordering to all the columns and the node and next_node variable and it should work. Then both the labels and the sankey will be correctly positioned. This may not work if you have the same label for different taxonomic levels, in this case you can add a prefix to each clade like "c__Haptophyta" and "f__Haptophyta" so that they are unique and then remove the prefix, in this case that's the
This is the resulting plot: Hope it helps! |
Hello developer! ,
I'm using geom_sankey() to plot microbial taxonomies by given taxonomic ranks. This is what I did:
colnames(taxonomy_table)
tableforsankey <- taxonomy_table %>%
make_long(Domain, Phylum, Class, Order, Family, Genus)
and this is the sankey that I get:
ribbons from phylum starts to intercross, is there a way in which I can display the sankey plot but specifying the ribbons to not cross over other ribbons ?
best regards,
Valentín.
The text was updated successfully, but these errors were encountered: