mfasiolo / mgcViz

An R package for interactive visualization of GAM models
https://mfasiolo.github.io/mgcViz/
76 stars 9 forks source link

Handling spatial object in 2D smooths #61

Open mfasiolo opened 5 years ago

mfasiolo commented 5 years ago

It would be nice to be able to do something like:

library(mgcViz) dat <- gamSim(1, n = 700, dist = "normal", scale = 2) b <- gamV(y ~ s(x0) + s(x1, x2) + s(x3), data = dat)

plot(sm(b, 2), newdata = mySpatialObject) + l_fitRaster()

Where mySpatialObject is of class "sf" or "sp", so that we could then be able to use the methods from the ggspatial package.

The basic problem is that mgcv does not understand spatial objects, and mgcViz has the same problem. Not sure how to do this.