'Plot two data.tree objects side by side
I am using the data.tree package to create some trees.
library(data.tree)
library(DiagrammeR)
acme <- Node$new("Acme Inc.")
accounting <- acme$AddChild("Accounting")
software <- accounting$AddChild("New Software")
standards <- accounting$AddChild("New Accounting Standards")
acme2 <- Node$new("Acme Inc. 2")
accounting2 <- acme2$AddChild("Accounting 2")
software2 <- accounting2$AddChild("New Software 2")
standards2 <- accounting2$AddChild("New Accounting Standards 2")
acme_plot <- plot(acme)
acme_plot2 <- plot(acme2)
I would like to put the two graphs next to each other in a grid. But as they are not ggplot objects (and I cannot convert them via ggplotify), I have failed with the following:
cowplotpar(mfrow)
I consulted this answer as well: Combine different grViz into a single plot but my trees are generated via a complex loop so I cannot generate them in the digraph boxes_and_circles call. Any ideas?
Solution 1:[1]
You can use the package manipulateWidget with the function combineWidgets.
If you want them side by side, this works:
manipulateWidget::combineWidgets(plot(acme), plot(acme2), ncol = 2)
You won't be able to put the objects acme_plot or acme_plot2 in that function; you have to enter the call that creates those objects.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kat |


