-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
simplify workflow #448
Comments
g <- graph(as.character(c(3, 1, 6, 3, 7, 3, 12, 6, 13, 6, 14, 7, 15, 7)))
plot(g, layout = layout_as_tree(g, root = "1", mode = "in")) If you want node labels, then you can use a character edge list. |
That was what I was missing. Any solution for showing the left child to the left and the right to the right? |
Not that I know of. You can take the calculated coordinates, and post-process them, I guess. |
In this SO post I plotted a binary tree by creating the layout for the full tree and then used the appropriate rows from its layout with the subset of nodes in the actual tree. It works to cause a left child to plot to the left of the parent even if there is no right child and similarly for a right child but I wonder if there could be some feature(s) to make this easier to do. |
The following code seems more complex than I would have thought for something that is pretty simple. Maybe I am missing some feature(s) that already exist but if not consider that we had to add names to prevent the names from changing, then we had to take a subgraph even though the subgraph is the entire graph (it adds nodes if this is not done) and finally plot it. Maybe some feature(s) could be added to make this easier to do.
One other problem which is actually distinct is that what I really wanted was to plot a binary tree showing the left child to the left and right child to the right where even numbered edges are left children and odd numbered edges are right but if there is only one child it plots it beneath so one can't tell whether it is a left or right child.
The text was updated successfully, but these errors were encountered: