2

plot3d当我使用包中的几个 3D 图像绘制时rgl,图像会单独显示。我想在一个绘图中显示它们,例如par(mfrow=c(2, 2))在一个绘图窗口中显示四个 2D 图像时。

这可能吗?

4

1 回答 1

4

命令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])
 }

要同时禁用所有实体的旋转,只需设置sharedMouse = FALSE即可。

于 2015-08-06T12:20:00.513 回答