当我绘制使用几个3D图像plot3d从rgl包,图像被分别显示。我想在一个图中显示它们,例如par(mfrow=c(2, 2))在单个绘图窗口中显示四个 2D 图像时。
这可能吗?
小智 5
命令layout3d可能有用。也许此代码可以帮助:
shapes <- list(Tetrahedron = tetrahedron3d(), Cube = cube3d(), Octahedron = octahedron3d(),
Icosahedron = icosahedron3d(), Dodecahedron = dodecahedron3d(),
Cuboctahedron = cuboctahedron3d())
col <- rainbow(6)
open3d()
mat <- matrix(1:4, 2, 2)
mat <- rbind(mat, mat + 4, mat + 8)
layout3d(mat, height = rep(c(3, 1), 3), sharedMouse = TRUE)
for (i in 1:6) {
next3d()
plot3d(shapes[[i]], col = col[i])
next3d()
text3d(0, 0, 0, names(shapes)[i])
}
Run Code Online (Sandbox Code Playgroud)
要停用所有实体的旋转,只需设置sharedMouse = FALSE 即可。