image3d                package:misc3d                R Documentation

_D_r_a_w _P_o_i_n_t_s _o_n _a _3_D _G_r_i_d

_D_e_s_c_r_i_p_t_i_o_n:

     Plots points on a three dimensional grid representing values in a
     three dimensional array. Assumes high values are inside and uses
     alpha blending to make outside points more transparent.

_U_s_a_g_e:

       image3d(v, x = 1:dim(v)[1], y = 1:dim(v)[2], z = 1:dim(v)[3],
               vlim = quantile(v, c(.9, 1),na.rm=TRUE),
               col = heat.colors(256), alpha.power = 2,
               alpha = ((1:length(col))/ length(col))^alpha.power,
               breaks, sprites = TRUE, jitter = FALSE, 
               radius = min(diff(x), diff(y), diff(z)),
               add = FALSE,...)

_A_r_g_u_m_e_n_t_s:

       v: three dimensional data array.

   x,y,z: locations of grid planes at which values in 'v' are measured.

    vlim: minimum and maximum 'v' values for which points are to be
          drawn.

     col: vector of colors for the points as generated by 'heat.colors'
          or similar functions.

alpha.power: used to calculate the alpha values. The larger the power,
          the smaller the alpha, the more transparent the point. Only
          used if 'alpha' is not supplied.

   alpha: vector of alpha values between 0 and 1.  The length of the
          vector should be equal to the length of 'col'.

  breaks: breakpoints for the colors; must give one more breakpoint
          than colors.

 sprites: logical;  if 'TRUE', use 'rgl.sprites' to draw the points.

  radius: radius used in 'rgl.sprites'.

  jitter: logical;  if 'TRUE', add a small amount of noise to the point
          locations.

     add: logical; if 'TRUE', add to current 'rgl' graph.

     ...: material and texture properties. See 'rgl.material' for
          details.

_R_e_f_e_r_e_n_c_e_s:

     Daniel Adler, Oleg Nenadic and Walter Zucchini (2003) RGL: A
     R-library for 3D visualization with OpenGL

_S_e_e _A_l_s_o:

     'image', 'rgl.sprites', 'rgl.points', 'jitter'.

_E_x_a_m_p_l_e_s:

         # view density of mixture of tri-variate normals
         nmix3 <- function(x, y, z, m, s) {
           0.4 * dnorm(x, m, s) * dnorm(y, m, s) * dnorm(z, m, s) +
             0.3 * dnorm(x, -m, s) * dnorm(y, -m, s) * dnorm(z, -m, s) +
               0.3 * dnorm(x, m, s) * dnorm(y, -1.5 * m, s) * dnorm(z, m, s)
         }
         f <- function(x,y,z) nmix3(x,y,z,.5,.5)
         x<-seq(-2,2,len=50)
         g <- expand.grid(x = x, y = x, z = x)
         v <- array(f(g$x, g$y, g$z), c(length(x), length(x), length(x)))
         image3d(v)
         image3d(v, jitter = TRUE)

