QBoard » Advanced Visualizations » Viz - Others » 3D visualization using R

3D visualization using R

  • I have a set of values, w, for each (x,y,z). I want to visualize this 4D data as an interactive 3D image plot.
    That is, each 3D pixel x,y,z should get some color based on w.

    PS: w ranges from 0-7, and the rest of the (x,yz) are just transparent.

      August 6, 2020 3:37 PM IST
    0
    • Mitali Bhavsar
      Mitali Bhavsar In general visualizing 3d clouds of points is rather difficult. Pseudo 3d with surfaces is ok but the points do not display with sufficient depth cues. If you really want to try it, then use the rgl package so you can rotate.
      September 25, 2020
  • Here is an example. Note that your z data needs to be a matrix with x rows and y columns.
    library(rgl)
    set.seed(1)
    x <- seq(1,10)
    y <- seq(1,10)
    w <- runif(100)
    z <- runif(100)
    
    wcolors <- rainbow(length(w))[rank(w)]
    zmat <- matrix(z, length(x),length(y))
    
    persp3d(x=x, y=y, z=zmat, col = wcolors)​
      August 6, 2020 3:40 PM IST
    0
  • 3D Visualization in R

    Plot 3D points

     

    Create an interactive visualization of a 3D static and animated points using the R package svgViewR.

     

    Plot 3D arrows

     

    Create an interactive visualization of 3D static and animated arrows using the R package svgViewR.

     

    Plot 3D spheres

     

    Create an interactive visualization of 3D static and animated spheres using the R package svgViewR (>=v1.3).

     

    Plot 3D mesh

     

    Create an interactive visualization of a mesh from an OBJ file using the R package svgViewR (>=v1.3).
      September 25, 2020 4:24 PM IST
    0
  • I use rgl for 3D visualization. You can rotate the image in rgl window using your mouse. Wheel zooms in/out.

    example(plot3d)
    rgl.bg(color = "black") # Space, the final Frontier.


      September 25, 2020 4:26 PM IST
    0