Is it possible to call the plot functions from the c++ ? Currently when I try to do that, the ubuntu terminal sort of freezes for sometime ( may be the duration for which the 3d plot would be created and then rotated for a full 360 degrees) and then unfreezes, without ever popping a new window. Is this the expected behavior or is there something that I am doing wrong ? How can I get the plots ( R graphics ) to run from within c++ using rinside and rcpp ?
Thnx
-Egon
Yes, there is a working examples in the Rcpp package. Look at the file functionCallback/newApiExample.r
in the examples/
directory.
You may need to experiment with sleep()
to 'hold' the plot for a moment, or plot to a file and then have the file displayed. It all depends but you gave little detail.
The environment variable which deals with the interactive session is R_INTERACTIVE_DEVICE
.
We need to create a file named .Renviron
in our home directory, and then add the following code to that file:
R_INTERACTIVE_DEVICE = X11
for Linux based systems.
anisha@linux-y3pi:~> ls .Renviron
.Renviron
anisha@linux-y3pi:~> cat .Renviron
R_INTERACTIVE_DEVICE = X11a
References:
1. http://stat.ethz.ch/R-manual/R-patched/library/base/html/Startup.html
2. http://stat.ethz.ch/R-manual/R-patched/library/base/html/options.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With