Skip to content
Prev 178674 / 398506 Next

image3d in misc3d

Hi,

I'm trying to make sense of the image3d plots in misc3d. Unfortunately I can't find any authors on the help pages of the function to e-mail directly. In the following toy example, I'm puzzled as to why (1) the positions of the image plot on the axes include negative values when I think I've specified all to be 1:3 and (2) the logic that needs to be adhered to in order to reliably match up the sphere plot with the image plot. 

library(misc3d)
##Set up array:
arr <- array(1:27, dim = rep(3,3))
## Plot image, with x, y, z positions all  set (I thought) to 1:3
image3d(arr, x = 1:3, y = 1:3, z = 1:3, vlim = quantile(arr, c(0.01, 0.99)))
## Add spheres of the same data at the same positions
spheres3d(x=expand.grid(x = 1:3, y = 1:3, z = 1:3), radius = 0.1 *sqrt(arr))

## Ooops! So why don't they match up? Add axes:

axes3d()
## For some reason the image3d is generating negative values of z...

spheres3d(x=expand.grid(x = 1:3, y = 1:3, z = -(1:3)), radius = 0.1 * arr^(1/3))
## But is this reliable? I've tried with a variety of plots and sometimes it seems as though another axis is the negative one...

I'm using:
R version 2.8.1 (2008-12-22) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.1252;LC_MONETARY=English_United Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats     graphics  grDevices datasets  tcltk     utils     methods   base     

other attached packages:
[1] rgl_0.83-3     misc3d_0.6-1   debug_1.1.0    mvbutils_1.1.1 svSocket_0.9-5 svIO_0.9-5     R2HTML_1.58    svMisc_0.9-5   svIDE_0.9-5   

loaded via a namespace (and not attached):
[1] tools_2.8.1


Thanks!

Colin