0

I produced 3D partial plot with pdp package like this:

partial1 <- pdp::partial(rf_full, pred.var = c("Long", "Lat"),
                         parallel = T, paropts =list(.packages = "randomForest"))
p2 <- plotPartial(partial1, levelplot = F, colorkey = T, plot.pdp = T)

However, the color of the target variable (yhat) 1) doesn't fill the grid cells and 2) seems to be always the same color (for high values of yhat). It looks as follow: enter image description here

Do you have any idea how to obtain something like this for instance:

enter image description here

FrsLry
  • 348
  • 4
  • 19
  • 2
    Can please you post a complete [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? – ziggystar Apr 26 '21 at 11:04

1 Answers1

1

Try plotting using the following option drape=T, which is an option of wireframe:

plotPartial(partial1, levelplot = F, colorkey = F, plot.pdp = F, drape=T)
ziggystar
  • 28,410
  • 9
  • 72
  • 124
  • Oh wow, it seems to work. Just, do you know why we must specify `colorkey = F`, it seems counter intuitive.. Same for the other argument `plot.pdp = F`, it's really the opposite of what I would write ^^` – FrsLry Apr 26 '21 at 16:24
  • @FrsLry No, I just looked through the documentation and searched for the option that you need. If my answer solves your problem, please accept it using the green checkmark. – ziggystar Apr 27 '21 at 06:46