Shapour
Shapour

Reputation: 21

Imaging a 3d array with R

I have got a question regarding array's visualization in R. There is an image() function which makes a 2d-image based on the matrix that it is received; however, this function are not valid for arrays.

So, how is it possible to make a 3d-image through a 3d-array?

For instance:

 y<-matrix(round(runif(144)),nrow = 12,ncol = 12,byrow = TRUE)
 image(y, axes=F)

Now how we can make a 3d image if we have:

y=array(data=round(runif(12*12*12))+1,dim = c(12,12,12))

Regards,

Shapour

Upvotes: 1

Views: 390

Answers (1)

Nar
Nar

Reputation: 658

there is image3d function in misc3d:

    library(misc3d)
    library(rgl)

    y=array(data=round(runif(12*12*12))+1,dim = c(12,12,12))
    image3d(y)

Upvotes: 1

Related Questions