简体   繁体   English

帮助使用rgl包

[英]Help in using rgl package

I installed rgl package with the option --disable-libpng. 我使用选项--disable-libpng安装了rgl包。 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()的信息

    > 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 这是来自sysname命令

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 我能够从R中的一些代码生成表面图:从x,y,z绘制3D表面

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. 我尝试了演示(rgl),这也是类似的消息崩溃。 I want to generate 3d plots, which other package do you recommend? 我想生成3d图,你推荐其他包吗? ggplot? ggplot?

The rgl package makes use of possible hardware acceleration in your graphics card via its driver. rgl软件包通过其驱动程序在您的图形卡中使用可能的硬件加速。

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. 多年来我一直在使用rgl进行动画可视化 - 例如,参见2005年的选项分析表面的可视化 - 我可以保证你在某些机器上没有任何理由而在其他机器上运行并且运行在其他机器上。 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. 另一个是双屏幕,因此没有GL扩展,所以它不会。 Did I mention hardware bites? 我提到硬件咬了吗?

I tested the exact same code on my system, and it worked perfectly. 我在我的系统上测试了完全相同的代码,它运行得很好。

Whatever the issues were, they have probably been fixed. 无论问题是什么,它们都可能已得到修复。

Test 1: 测试1:

library(rgl)
demo(rgl)

Test 2: 测试2:

library(rgl)
open3d()
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
plot3d(x, y, z, col=rainbow(1000))

My system is Windows 7 x64 running R v2.14.2. 我的系统是运行R v2.14.2的Windows 7 x64。 Tested under two IDEs, namely Revolution R and RStudio. 在两个IDE下测试,即Revolution R和RStudio。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM