I try to plot a dendrogram with the ggraph
package but, it's ok with geom_edge_diagonal()
but not with geom_edge_elbow()
Packages
library(phyloseq)
library(igraph)
library(ggraph)
Getting data
The file ps.rds is available here
https://github.com/spholmes/F1000_workflow/tree/master/data
ps <- readRDS("ps.rds")
EdgeList <- phy_tree(ps)$edge
Tree <- graph_from_edgelist(EdgeList, directed = TRUE)
Plotting
ggraph(Tree, 'dendrogram') +
geom_edge_diagonal()
This code works but the plot is not very beautiful.
And now :
ggraph(Tree, 'dendrogram', circular = TRUE) +
geom_edge_elbow()
Error in FUN(X[[i]], ...) : object 'direction' not found
So I have some questions :
- Why it doesn't work yhereas it works for the other dendrogram ?
- What is direction ? In the package documentation, it is said that direction is "automatically set" https://www.rdocumentation.org/packages/ggraph/versions/0.1.1/topics/geom_edge_elbow
- Can I found something useful for plotting in the ps object ?
EDIT after F. Privé comment
Yes, it's possible to mix dendrogram
and circular
.
ggraph(Tree, 'dendrogram', circular = TRUE) +
geom_edge_diagonal()