Options to modify palettes
JeromeMathieuEcology opened this issue · 1 comments
JeromeMathieuEcology commented
Hi, A small suggestion:
to give the possibility to adjust the palette used for the pdps in partial().
For instance: direction, begin and end.
Thks,
Jérôme
bgreenwell commented
Hi @JeromeMathieuEcology, sorry for the long delay in response, but you can already do that. Here's a minimal example using both plotting functions:
library(pdp)
library(ggplot2)
library(ranger)
rfo <- ranger(cmedv ~ ., data = boston)
pd <- partial(rfo, pred.var = c("rm", "lstat"), chull = TRUE)
pal1 <- viridisLite::inferno(100, alpha = 1, begin = 0, end = 0.3)
pal2 <- viridisLite::inferno(100, alpha = 1, begin = 0.3, end = 0.9)
gridExtra::grid.arrange(
plotPartial(pd, col.region = pal1),
plotPartial(pd, col.region = pal2),
autoplot(pd, palette = "inferno", begin = 0, end = 0.3),
autoplot(pd, palette = "inferno", begin = 0.3, end = 0.9),
nrow = 2
)