【问题标题】:Quenstions about rgl layout3d plot3d关于rgl layout 3d plot3d的问题
【发布时间】:2018-03-10 12:17:12
【问题描述】:

我正在尝试使用 R 中的 rgl 包为具有多个子图的 3d 图添加整体标题,并且我还尝试设置两个子场景之间的距离。在 2D 绘图中,我们可以使用 title("my title",outer=TRUE) 给出整体标题,并使用 "mar" 设置边距。那么,对应的参数是什么呢? 这是我的代码:

 rgl.viewpoint(0,0,fov=0)
 par3d(windowRect=c(50,50,700,700),zoom=0.8)
 mat<-matrix(c(1,2,3,4,5,6),3,2,byrow = TRUE)
 height<-c(2,2,2)
 width<-c(1,1)
 layout3d(mat, height = height,width=width,sharedMouse = TRUE)
 for (i in 1:6) {
    next3d()
    shade3d(shapes[[i]], col = col[i])
 }

我想在图片中放一个标题,并调整两个子图之间的距离。

【问题讨论】:

  • 请检查您的代码,因为我收到了Error in shade3d(shapes[[i]], col = col[i]) : object 'shapes' not found
  • shapes

标签: r title rgl


【解决方案1】:

rgl 中没有外部区域的概念。您需要做的是在布局中添加另一个区域,并将标题放在那里。例如,

library(rgl)
open3d()
mat<-matrix(c(7,7,1,2,3,4,5,6),4,2,byrow = TRUE)
height<-c(1,2,2,2)
width<-c(1,1)
layout3d(mat, heights = height, widths=width, sharedMouse = TRUE)
for (i in 1:6) {
        next3d()
        shade3d(cube3d(), col = i)
}
next3d()
text3d(0,0,0,"My title")

【讨论】:

  • 非常感谢!!!我还有一个问题:如何调整两个形状之间的距离?例如,我想关闭两个形状,该怎么做?
  • 我不知道你在问什么。将一个单独的问题与示例代码等放在一起,可能会有人回答。
  • 感谢@user2554330 的最佳方式是接受他的回答
  • @user2554330 我用你的代码绘制了一张图片,图中有六个立方体,两个立方体之间的间隙对我来说太大了,所以我希望间隙变小。如何设置?
猜你喜欢
  • 1970-01-01
  • 2012-02-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多