Albluca / ElPiGraph.R

An R package to construct Elastic Principal Graphs
GNU General Public License v3.0
22 stars 9 forks source link

changed plotPieNet -> add RootLevel argument #14

Closed charles-bernard closed 6 years ago

charles-bernard commented 6 years ago

Dear Luca,

I hope you are going well. I wanted to propose to you this very small PR. Free to you to take it or not :)

I have figured out that in the plotPieNet function, if one wants to set two Roots, LayOut = "tree", TreeRoot = c(root1, root2), then the function will consider that the two roots begin at the exact same level (or same pseudotime if you like) as illustrated below:

no_levels

But you can actually change this behaviour in the igraph::layout_as_tree function if you permit it to set a rootlevel argument. For instance: setting the function to igraph::layout_as_tree(graph = igraph::as.undirected(Net, mode = 'collapse'), root = TreeRoot, rootlevel = c(6, 1)) will eventually lead to this plot

levels

Perhaps could this small change be useful for users dealing with converging roots in their trajectories (i.e me ahah !)...

Anyway, I wish you a nice evening !

See you around ;)

Charles

Albluca commented 6 years ago

Hi Charles,

thank you for bringing this up :) It's an interesting suggestion! I'll merge the commit into the main branch right now.