From ripley at stats.ox.ac.uk  Mon Jan  9 15:52:18 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 9 Jan 2006 14:52:18 +0000 (GMT)
Subject: [Rd] R plot display problem under windows when using python rpy
 module.
In-Reply-To: <6ea7b5430601090629u6c3a6ed4r41d096e61c2579e7@mail.gmail.com>
References: <6ea7b5430601090629u6c3a6ed4r41d096e61c2579e7@mail.gmail.com>
Message-ID: <Pine.LNX.4.61.0601091446430.13067@gannet.stats>

How is Rpy calling R?  Presumably R is running single-threaded, and the 
problem is likely to be that Rpy is using blocking I/O on the R process 
and hence blocking the GUI callbacks that drive the window.

The not-so-simple answer is not to do it that way.  It might be well
sufficient to turn windows() buffering off -- see its help page.

On Mon, 9 Jan 2006, Bo Peng wrote:

> Dear list,
>
> Rpy is a python module that provides python interface to R. The
> following simple commands
>
>>>> from rpy import *
>>>> r.plot(0)
>
> is supposed to create a window that displays the result of plot(0).
>
> However, we observe that
> 1. Under *nix, rpy+R+python  work as expected
> 2. Under windows, python + pythonWin32 (a python GUI provided by the
> pywin32 module), work as expected
> 3. Under windows, if we run the commands from command line or IDLE (a
> simple python IDE), a window will be created, but the figure will not
> be drawn. Then, if we run r.plot(2), the result of plot(0) will be
> drawn. plot(2) will be displayed when the next drawing command is
> executed.
>
> Since R works well in most cases, I do not think this is a R problem.
> However, can anyone tell me what *might* block the figures from being
> displayed? In other word, what might PythonWin have provided to enable
> correct rendering of the figures? If I have to trace to the sources,
> what portion of the R code should I have a look at? (It is good that
> python/R/rpy are all open source).
>
> Many thanks in advance.
> Bo
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] R plot display problem under windows when using python rpy module.
Prof Brian Ripley