Closed auroreRECE closed 3 years ago
ggarrange seems to work fine. Which problems are you running into?
library(ggparty)
#> Loading required package: ggplot2
#> Loading required package: partykit
#> Loading required package: grid
#> Loading required package: libcoin
#> Loading required package: mvtnorm
data("WeatherPlay", package = "partykit")
sp_o <- partysplit(1L, index = 1:3)
sp_h <- partysplit(3L, breaks = 75)
sp_w <- partysplit(4L, index = 1:2)
pn <- partynode(1L, split = sp_o, kids = list(
partynode(2L, split = sp_h, kids = list(
partynode(3L, info = "yes"),
partynode(4L, info = "no"))),
partynode(5L, info = "yes"),
partynode(6L, split = sp_w, kids = list(
partynode(7L, info = "yes"),
partynode(8L, info = "no")))))
py <- party(pn, WeatherPlay)
b <- ggparty(py) +
geom_edge() +
geom_edge_label() +
geom_node_label(aes(label = splitvar),
ids = "inner") +
geom_node_label(aes(label = info),
ids = "terminal")
a <- ggplot(cars) +
geom_point(aes(speed, dist))
ggpubr::ggarrange(a, b, ncol = 1, nrow = 2)
Created on 2021-01-14 by the reprex package (v0.3.0)
Thank you, it works. I changed the version of the ggparty library, maybe it was the problem.
Hello,
Sorry if it is not the good place to ask this. Is there any way to combine a classic ggplot (for example a = ggplot()+geom_point()) with a ggparty plot (b = ggparty(py)) ? With a function like ggarrange or grid.arrange (e.g., ggarrange(a,b)).
Thank you for your help
Aurore