1

I have one raster and one scatter plot that I want to put together in a single multipanel plot. However, the par(mfrow=c()) that usually works to put together different normal plots, it doesn't work when I am trying to visualize a raster with the sp::spplot function. I am looking for a way to put both types of plots together in a single figure

This an example code what I have been trying to do, but end it ends with the plot in separate figures.

library(sp)

r <- raster(system.file("external/test.grd", package="raster"))
x <- rnorm(100, 1, 2)
y <- rnorm(100, 1, 5)

par(mfrow=c(1,2))
spplot(r)
plot(x, y)

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.