Re: [S] animation and pausing

Prof Brian Ripley (
Fri, 3 Apr 1998 07:56:59 +0100 (BST)

Tony Plate wrote:
> Terje Jorgensen writes:
> >I did not get any feedback on my previous submisssion of this query to the
> >list so I take the liberty of re-submitting it.
> >
> >To create animation, I want the result of each plotting command within a
> >function to be displayed immediately upon completion of that command.
> >As is, everything is plotted upon exit (return) from the function.
> >
> >How can I force the immediate display to a graphic window of the result of
> >a plotting command that is part of a function?
> > [the code Terje provides used a busy wait to pause for one second between
> > plotting each point, but the display was not updated until the entire
> > function completed.]
> I can't help you directly, as I don't run S+ under windows,
> but I wonder if your problem is the busy wait you use for
> pause().
> Under Unix, the normal behaviour of the plot(), points(), etc. commands
> is to immediately display the resulting graphic.

I assume we are talking about using a motif/openlook graphics device under
Unix, and a graphsheet under S-PLUS 4.0. Those of us who have used the
latter know that it often does not respond at all (even to bring the
window to the front) whilst an S function is running. The fundamental
difference is that under Unix the graphics devices run as a separate
process connected by a pipe, and normal Unix multi-tasking applies. I
don't know how S-PLUS 4.0 is actually implemented, but it is reported by
Windows 95 as a single task with a single thread. If this is accurate,
the designers will have had to allocate time to graphics calls from within
the S engine loop, in a similar way to programming a graphics program
under X toolkits (which generally go and do graphics calls during I/O, but
have calls which users can insert to give time).

Certainly my experience is that code which under 3.3 for Windows plotted
a line after each of a series of simulations plotted all the lines
quickly after all the simulations were done in 4.0.

This seems a technical question for the designers of 4.0. Would
someone at MathSoft care to respond?

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
This message was distributed by  To unsubscribe
send e-mail to with the BODY of the
message:  unsubscribe s-news