-1

Is it possible to create an image like this one by using R?

enter image description here

The image is taken from UseR! 2019 Spatial workshop part I.

1

using rgl and pals for colours:

> library(rgl)
> library(pals)

make some data

> m = matrix(runif(54),6,9)

cut into 10 categories and lookup colour in a palette of 10 colours:

> col = pals::viridis(10)[cut(m, 10)]

start the engines...

> open3d()
glX 
  5 

plot as many as you like at different Z coordinates, starting at zero:

> surface3d(1:9, 1:6, rep(0,length(col)), color = col, back = "lines", smooth=FALSE)
> surface3d(1:9, 1:6, rep(1,length(col)), color = col, back = "lines", smooth=FALSE)
> surface3d(1:9, 1:6, rep(2,length(col)), color = col, back = "lines", smooth=FALSE)
> surface3d(1:9, 1:6, rep(3,length(col)), color = col, back = "lines", smooth=FALSE)

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.