为什么我的 3D 绘图没有显示在 R Studio 绘图查看器中?
Why is my 3D plot not showing up in R Studio plot viewer?
我通常在 RStudio(版本 1.0.44)中查看绘图时没有问题,但是当我尝试查看使用 "rgl" 包创建的 3D 绘图时,我的 RStudio 绘图查看器中没有任何显示.
我可以毫无问题地绘制 plot(cars) 散点图。
这是我使用的代码:
install.packages("rgl")
library(rgl)
plot3d(iris[1:3]) # Nothing appears in RStudio plot viewer
plot(cars) # The cars scatterplot appears in my RStudio plot viewer
dev.off()
知道为什么会这样吗?我还应该尝试什么?当我 运行 plot3d(iris[1:3]) 时,我没有收到任何错误。我检查了 head(iris[1:3]) 以确保我正确加载了虹膜数据。我也试过改变情节边距:
par(mar=c(4,4,4,4)
谢谢
- "Output may be on screen using OpenGL, or to various standard 3D file formats including WebGL, PLY, OBJ, STL";
- "There are two ways in which rgl scenes are normally displayed within R. The older one is in a dedicated window. In Unix-alikes this is an X11 window; it is a native window in Microsoft Windows. On MacOS, the XQuartz system (see http://xquartz.org) needs to be installed to support this."
- "The newer way to display a scene is by using WebGL in a browser window or in the Viewer pane in RStudio. To select this, set options(rgl.printRglwidget = TRUE). Each operation that would change the scene will return a value which triggers a new WebGL display when printed."
文档 FTW
图书馆(rgl)
pca3d(set.final.pca,group=set.final$Groups,show.labels=TRUE,show.centroids=TRUE,show.ellipses=FALSE,show.group.labels=假)
rglwidget()
我通常在 RStudio(版本 1.0.44)中查看绘图时没有问题,但是当我尝试查看使用 "rgl" 包创建的 3D 绘图时,我的 RStudio 绘图查看器中没有任何显示.
我可以毫无问题地绘制 plot(cars) 散点图。
这是我使用的代码:
install.packages("rgl")
library(rgl)
plot3d(iris[1:3]) # Nothing appears in RStudio plot viewer
plot(cars) # The cars scatterplot appears in my RStudio plot viewer
dev.off()
知道为什么会这样吗?我还应该尝试什么?当我 运行 plot3d(iris[1:3]) 时,我没有收到任何错误。我检查了 head(iris[1:3]) 以确保我正确加载了虹膜数据。我也试过改变情节边距:
par(mar=c(4,4,4,4)
谢谢
- "Output may be on screen using OpenGL, or to various standard 3D file formats including WebGL, PLY, OBJ, STL";
- "There are two ways in which rgl scenes are normally displayed within R. The older one is in a dedicated window. In Unix-alikes this is an X11 window; it is a native window in Microsoft Windows. On MacOS, the XQuartz system (see http://xquartz.org) needs to be installed to support this."
- "The newer way to display a scene is by using WebGL in a browser window or in the Viewer pane in RStudio. To select this, set options(rgl.printRglwidget = TRUE). Each operation that would change the scene will return a value which triggers a new WebGL display when printed."
文档 FTW
图书馆(rgl)
pca3d(set.final.pca,group=set.final$Groups,show.labels=TRUE,show.centroids=TRUE,show.ellipses=FALSE,show.group.labels=假) rglwidget()