First 3D representation with R

Well this is one of the first 3D images I was able to get from R.  It was created with random data and bin number was set to 10 on x,y and z coordinates. Resolution was too coarse to  obtain a decent “mixing” time.

First3Drepresentation

First 3D representation of particle count in the studied vessel. Color indicates particle number, legend was still not created.

 

 

This image was created with scatterplot3D library, with symbols set to cube, Color scale denotes particle count in that “cube”. Legend was still not created. I’ll post the script later.

This entry was posted in 3D. Bookmark the permalink.

4 Responses to First 3D representation with R

  1. Tom says:

    Hi,
    Do you have the R code for this? I tried with the plane3d function returned by scatterplot3d, to no avail… :-/
    Thanks!

    • admind says:

      Hallo, I guess you are the first comment that is not spam. I will look for it. I have not touched R in a few months. I upload it here if I find it.

    • admind says:

      Hello, well I just had some time and got back to the old files, it is not done with scatterplot3d it is done with the RGL library. The next few lines are an example.

      #load library rgl
      library("rgl")
      #Give values to X,Y,Z to plot
      x=c(1,2,3,4,5,6,7,8)
      y=c(2,3,4,5,6,7,8,9)
      z=c(3,4,5,6,7,8,9,10)
      #Set some fancy color scale (it is not the simplest one just pasted from other code I had)
      lc = cbind(seq(1,100,by=2))
      lc = cut(lc, breaks=50)
      colslc=rainbow(50)[as.numeric(lc)]
      #Actually do the plotting
      shapelist3d(cube3d(), x, y, z, col=colslc,alpha=seq(0.1,1,length=100), size=0.42, override=TRUE)
      #Save the output file to png file format with specific name
      filename3 < - paste("rglexample",".png",sep="")
      rgl.snapshot(filename3)

      ----------
      Hope it helps!

  2. Tom says:

    That’s great- Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>