我已经生成了一些偏相关图。
library(mlr)
plots = plotPartialDependence(pd)
输出看起来像这样:
class(plots)
[1] "gg" "ggplot"
pd
默认情况下,此功能将绘图打印在一页上。但是,由于地块很多,所以看不到任何细节。有没有办法在多页上打印图(即每页4个图,例如nrows = 2 / ncols = 2)? 我已经阅读了有关此主题的一些帖子,但它们处理的是用户而非函数生成的图。因此,这对我没有帮助。
这里是5个功能的小例子。
structure(list(data = structure(list(review_count = c(73.1921519112757,
72.9381584023148, 72.9381584023148, 72.9381584023148, 72.9381584023148,
63.1251979284659, 63.1251979284659, 63.1251979284659, 63.1251979284659,
63.1251979284659, 45.1564179015755, 45.1564179015755, 45.1564179015755,
45.1564179015755, 45.1564179015755, 70.3673395995618, 70.3673395995618,
70.3673395995618, 70.3673395995618, 70.3673395995618, 62.363785022433,
61.3743337919256, 61.3743337919256, 61.3743337919256, 61.3743337919256,
64.3075754021323, 64.3075754021323, 64.3075754021323, 64.3075754021323,
64.3075754021323, 58.1782568771601, 58.1716123314153, 58.1716123314153,
58.1716123314153, 58.1716123314153, 95.6300994996321, 95.6300994996321,
95.6300994996321, 95.6300994996321, 95.6300994996321, 65.8695037727425,
66.679524424974, 66.679524424974, 66.679524424974, 66.679524424974,
43.4884670405162, 43.4884670405162, 43.4884670405162, 43.4884670405162,
43.4884670405162), diveyTrue = c(0, 0.111111111111111, 0.222222222222222,
0.333333333333333, 0.444444444444444, 0.555555555555556, 0.666666666666667,
0.777777777777778, 0.888888888888889, 1, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA), dinnerTrue = c(NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, 0, 0.111111111111111, 0.222222222222222, 0.333333333333333,
0.444444444444444, 0.555555555555556, 0.666666666666667, 0.777777777777778,
0.888888888888889, 1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA), BikeParkingTrue = c(NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0, 0.111111111111111,
0.222222222222222, 0.333333333333333, 0.444444444444444, 0.555555555555556,
0.666666666666667, 0.777777777777778, 0.888888888888889, 1, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA), latenightTrue = c(NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, 0, 0.111111111111111, 0.222222222222222,
0.333333333333333, 0.444444444444444, 0.555555555555556, 0.666666666666667,
0.777777777777778, 0.888888888888889, 1, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA), NoiseLevelquiet = c(NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, 0, 0.111111111111111, 0.222222222222222, 0.333333333333333,
0.444444444444444, 0.555555555555556, 0.666666666666667, 0.777777777777778,
0.888888888888889, 1)), row.names = c(NA, -50L), class = c("data.table",
"data.frame"), .internal.selfref = <pointer: 0x0000000002521ef0>),
task.desc = structure(list(id = "dat", type = "regr", target = "review_count",
size = 9943L, n.feat = c(numerics = 79L, factors = 0L,
ordered = 0L, functionals = 0L), has.missings = TRUE,
has.weights = FALSE, has.blocking = FALSE, has.coordinates = FALSE), class = c("RegrTaskDesc",
"SupervisedTaskDesc", "TaskDesc")), target = c("diveyTrue",
"dinnerTrue", "BikeParkingTrue", "latenightTrue", "NoiseLevelquiet"
), features = c("diveyTrue", "dinnerTrue", "BikeParkingTrue",
"latenightTrue", "NoiseLevelquiet"), derivative = FALSE,
interaction = FALSE, individual = FALSE), class = "PartialDependenceData")