Hi Gabriella,

Long story short, the R package `rgl` is requiring an interactive OpenGL R
plotting device, which is the window you see appearing (and disappearing).
For integration in the jupyter notebook, other plotting systems might be
better (bokeh, plotly, may be matplotlib).

When it comes to R devices, the following can help:

```
from rpy2.robjects.lib import grdevices

# list opened devices
grdevices.dev_list(()

# close current devices
grdevices.dev_off()

# there are others grdevices.dev_* functions...
```

Responsiveness to resizing can be achieved with the R event loop:
http://rpy2.readthedocs.io/en/version_2.8.x/interactive.html#r-event-loop

Best,


Laurent


---------- Forwarded message ----------
From: Csima, Gabriella <gabriella.cs...@metoffice.gov.uk>
Date: 2016-07-14 11:26 GMT-04:00
Subject: Re: [Rpy] rpy2-2.8.2 is out and on pypi
To: "RPy help, support and design discussion list" <
rpy-list@lists.sourceforge.net>


Hi Laurent,



Thank you very much for your response.



Finally, I could install the latest version on my own directory (2.8.2),
and now, many problems, that I had mentioned in my previous mail, has been
solved.



On the other hand, I still have the problem with the 3dpersp plot in
ipython notebook, as my program is opening a new window, that is quite
vulnerable: if I open or move a window onto that window, the plot
disappeared forever, but  I cannot delete the window at all.



My program is here (again):



**********

import iris

import numpy as np

%load_ext rpy2.ipython



cube = iris.load_cube(iris.sample_data_path(“air_temp.pp”))



x=np.arange(1,74,1)

y=np.arange(1,97,1)

z=cube.data



%%R

library(rgl)

library(gplots)

plot3dperscolFunc = function(x,y,z){

c=z

c = cut(c, breaks=85)

colsrich = rich.colors(85)[as.numeric(c)]

r3dDefaults$windowRect <- c(0,50, 800, 800)

persp3d(x, y, z, col=colsrich, size=2)

#rgl.snapshot("myplot.png")

}

%Rpush x y z

%R plot3dperscolFunc(x,y,z)

*****************

Could you suggest what I need to do to get the plot inside the ipython
notebook?

Is there any chance to run it on normal python (so, not ipython notebook),
that I could rotate the plot like in the R? (It is not so important, but I
would be very happy, if there would be a method to do that!)

Thank you very much,

Gabi



*From:* Laurent Gautier [mailto:lgaut...@gmail.com]
*Sent:* 10 July 2016 17:26
*To:* RPy list
*Subject:* [Rpy] rpy2-2.8.2 is out and on pypi





It mostly addresses issues caused when using the latest releases of
3rd-party optional dependencies (R's dplyr and ipython).



Changes will be tracked at

http://rpy2.readthedocs.io/en/version_2.8.x/changes.html#release-2-8-2

as soon as the rebuild of the doc is complete.



Laurent

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to