How can I control where the R graph is displayed using python and rpy2?

I am writing a program in Python. The first thing that happens is that a window is displayed (I use wxPython), which has some buttons and text. When the user performs some actions, the graph is displayed in its own window. This graph is made using R using rpy2. The problem is that the plot usually pops up over the main window, so the user needs to move the plot to see the main window again. This is a big problem for the user because he is lazy and useless. He wants the plot to just appear somewhere else, so he can simultaneously see the main window and the plot without raising his finger.

Two potential solutions to my problem:
(1) display the graph inside the wxPython frame (which, I think, I could control the location), or
(2) be able to specify where the graph window appears on the screen.

I can’t figure out how to do this.

+3
source share
2 answers

Select the image file using jpeg(), png()or another device, then map this file to your wxWidget.

+5
source

There are several lines in the documentation: http://rpy.sourceforge.net/rpy2/doc-2.2/html/graphics.html

R "" (X11). (jpeg, png, pdf - pdf, , , ).

rpy2-2.2.0dev , (, matplotlib wxWindows), , , , , , .

0

Source: https://habr.com/ru/post/1790821/


All Articles