帮助使用 rgl 包
我使用选项 --disable-libpng 安装了 rgl 软件包。我尝试生成 3D 散点图,但它崩溃了。请帮助我解决这个问题
这是我正在运行的代码
library(rgl)
open3d()
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
plot3d(x, y, z, col=rainbow(1000))
它崩溃并显示以下消息
*** caught segfault ***
address (nil), cause 'memory not mapped'
Traceback:
1: .External(rgl_par3d, args)
2: par3d(skip)
3: plot3d.default(x, y, z, col = rainbow(1000))
4: plot3d(x, y, z, col = rainbow(1000))
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:
这是来自 sessionInfo() 的信息
> sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-unknown-linux-gnu
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
[5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgl_0.92.798
这是来自 sysname 命令
x86-64_linux_2.6.16_ImageSLES10SP3-3
更多信息:
我能够从 R:从 x、y、z 绘制 3D 表面
这是代码
x <- seq(-10, 10, length.out = 50)
y <- x
rotsinc <- function(x,y) {
sinc <- function(x) {
y <- sin(x)/x;
y[is.na(y)] <- 1;
y
}
10 * sinc( sqrt(x^2+y^2) )
}
z <- outer(x, y, rotsinc)
surface3d(x, y, z)
我尝试了 demo(rgl),它也因类似的消息而崩溃。我想生成 3d 绘图,您推荐哪个其他软件包?格图?
I installed rgl package with the option --disable-libpng. I tried generating a 3d scatter plot and it crashes. Please help me in resolving this
This is the code i am running
library(rgl)
open3d()
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
plot3d(x, y, z, col=rainbow(1000))
It crashes with below messages
*** caught segfault ***
address (nil), cause 'memory not mapped'
Traceback:
1: .External(rgl_par3d, args)
2: par3d(skip)
3: plot3d.default(x, y, z, col = rainbow(1000))
4: plot3d(x, y, z, col = rainbow(1000))
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:
Here is the information from sessionInfo()
> sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-unknown-linux-gnu
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
[5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgl_0.92.798
This is from the sysname command
x86-64_linux_2.6.16_ImageSLES10SP3-3
Some more info:
I am able to generate a surface plot from some code in R: Plotting a 3D surface from x, y, z
Here is the code
x <- seq(-10, 10, length.out = 50)
y <- x
rotsinc <- function(x,y) {
sinc <- function(x) {
y <- sin(x)/x;
y[is.na(y)] <- 1;
y
}
10 * sinc( sqrt(x^2+y^2) )
}
z <- outer(x, y, rotsinc)
surface3d(x, y, z)
I tried demo(rgl) and that is also crashing with similar message. I want to generate 3d plots, which other package do you recommend? ggplot?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
rgl 包通过其驱动程序利用显卡中可能的硬件加速。
不幸的是,这完全取决于驾驶员。我多年来一直使用 rgl 进行动画可视化——参见例如 < a href="http://dirk.eddelbuettel.com/code/rquantlib-rgl.html" rel="nofollow">2005 年期权分析表面的可视化——我可以保证你会因为它而崩溃在某些机器上没有充分的理由,而在其他机器上运行。在做出任何确定的结论之前,您确实应该尝试使用不同的驱动程序在不同的机器上。
计算机使用硬件,有时硬件也会起作用。我可以在我的一台机器上很好地执行你的代码。另一种是双屏,因此没有 GL 扩展,所以不会。我有没有提到硬件咬合?
The rgl package makes use of possible hardware acceleration in your graphics card via its driver.
This is unfortunately entirely dependent on the driver. I have been using rgl for animated visualization for a number of years---see eg this visualization of option analytics surfaces from 2005---which I can assure you crashed for no good reason on some machines and runs on others. You really should try on a different machine with a different driver before making any firm conclusions.
Computers use hardware, and sometimes the hardware bites. I can your code fine on one of my machines. Another is dual-screen and hence without GL extension so it won't. Did I mention hardware bites?
我在我的系统上测试了完全相同的代码,它运行得很好。
无论问题是什么,它们可能已经得到解决。
测试 1:
测试 2:
我的系统是运行 R v2.14.2 的 Windows 7 x64。在两个 IDE 下进行测试,即 Revolution R 和 RStudio。
I tested the exact same code on my system, and it worked perfectly.
Whatever the issues were, they have probably been fixed.
Test 1:
Test 2:
My system is Windows 7 x64 running R v2.14.2. Tested under two IDEs, namely Revolution R and RStudio.