-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.

3

3 Answers 3

3

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

0

Here is a modern solution: https://www.urbandemographics.org/post/figures-map-layers-r/

Unfortunately it is not a package, but still very easy to use.

0

Also, there is a CRAN package too: https://marcosci.github.io/layer/

1
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review Commented Jun 14, 2023 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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