Question: Use Perl To Call R To Create Interactive 3D Plot
3
gravatar for qiyunzhu
6.7 years ago by
qiyunzhu420
Buffalo
qiyunzhu420 wrote:

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 • 3.3k views
ADD COMMENTlink modified 6.7 years ago by Malachi Griffith18k • written 6.7 years ago by qiyunzhu420

Relevance of this question to a bioinformatics research problem please?

ADD REPLYlink written 6.7 years ago by Neilfws48k

better ask this is stack overflow

ADD REPLYlink written 6.7 years ago by Flow1.5k
2
gravatar for Malachi Griffith
6.7 years ago by
Washington University School of Medicine, St. Louis, USA
Malachi Griffith18k wrote:

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 COMMENTlink written 6.7 years ago by Malachi Griffith18k

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

ADD REPLYlink written 6.7 years ago by qiyunzhu420
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1844 users visited in the last hour