Use Perl To Call R To Create Interactive 3D Plot
1
3
Entering edit mode
11.1 years ago
qiyunzhu ▴ 430

Hello all,

I'm stuck with a specific question concerning the communication between Perl and R, via Perl module Statistics::R. I want to create an interactive 3D scatter plot using R module rgl. When I manually did it in R console, it worked perfectly. I could mouse-rotate the graph in a window. However, when I tried to automate the process with Perl, the graph was displayed, but was dead. I couldn't rotate. My system is Ubuntu 12.04. Perl and R are up-to-date. I don't know where the problem is, but just guess it's a window rendering problem.

What I did in Perl is (simply):

$R->send("library('rgl')");
$R->send("plot3d(x, y, z, xlab='x', ylab='y', zlab='z', title='3D scatter plot')");

Can anyone point out what is wrong? Thanks!

perl r visualization • 4.6k views
ADD COMMENT
0
Entering edit mode

Relevance of this question to a bioinformatics research problem please?

ADD REPLY
0
Entering edit mode

better ask this is stack overflow

ADD REPLY
2
Entering edit mode
11.1 years ago

I suspect this may not possible in the way that you hope... Although I also hope I am wrong because I can think of some potential use cases for this behavior.

This question is probably of interest to many here who routinely visualize biological data in R, but I agree with Neilfws that it is perhaps more suited to stackoverflow.

These questions from stackoverflow sound relevant:

Switch R script from non-interactive to interactive

Running Statistics::R module in Perl on Mac OS - no image being produced

As do these threads from the R mailing list

[R] R script to start session (without automatically finishing)

[R] Non-interactive sessions

From this thread: "You need to explicitly start an x11 driver if you are not running interactively, ie using the x11() function."

ADD COMMENT
0
Entering edit mode

Thank you very much for these links! They are very informative and helpful!

ADD REPLY

Login before adding your answer.

Traffic: 2927 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6