[6327] in s-news-athena
Re: Interactive preparation of presentation graphics from S
daemon@ATHENA.MIT.EDU (Douglas Bates)
Tue Jan 31 11:20:35 1995
Date: Tue, 31 Jan 95 09:52:13 -0600
From: bates@stat.wisc.edu (Douglas Bates)
To: nader@math.chalmers.se
Cc: s-news@stat.wisc.edu
In-Reply-To: <199501311215.NAA06488@shilov.math.chalmers.se> (message from Nader Tajvidi on Tue, 31 Jan 1995 13:15:21 +0100 (MET))
>>>>> Nader Tajvidi <nader@math.chalmers.se> writes:
> I think the techniques you've described above are very
> interesting. My simple question is how you store a plot as a "source
> file" in Splus. I also use S-mode but I can't use "sink" to store an
> object (my computer hangs up). I appreciate a simple demonstration
> of the above techniques with Splus commands.
I do this in two ways. Most commonly, I start editing a file of S
commands using S-mode. That is, "C-x C-f plot1.S". If the extension
.S has not been added to the auto-mode-alist, you will also have to
manually establish S-mode with "M-x S-mode". (StatSci prefers the
extension .q for S source code.)
I also start an inferior S process using "M-x S".
I make sure to call the graphics driver and to turn it off in the file
I am editing. (In S this is done by calling graphics.off() - I can't
remember how this is done in S-plus). I also do any attachments and
detachments of frames or directories I will need. My goal is to leave
S in the same state when execution of the file finishes as it was when
execution started.
The emacs key sequence "C-c C-b" sends the current buffer to the S
process. I then use ghostview to view the PostScript file I have
created, go back and modify the plot commands, hit "C-c C-b" again,
... until I am satisfied with the plot.
If I have not thought ahead and created the plot as a separate file, I
can still use cut-and-paste to clip the relevant parts from the S
process buffer. Use this to create a file called an S-transcript.
The usual extension for the file name is .St and the file should have
the mode set to S-transcript-mode. There is a function within
S-transcript-mode that will clean up the transcript by removing any
prompts or output. The cleaned file can then be stored as S commands
and modified as desired.
As I recall, S-transcript-mode is not well documented in the texinfo
file accompanying the S-mode source. I think you have to do a bit of
browsing in the source to find out about it. It does have
documentation that can be displayed through "C-h m" (describe-mode).
Version 4.5 of S-mode is available as a gzip'd tar file from
ftp://wingra.stat.wisc.edu/pub/src/emacs-lisp
The designer and author of S-mode is David Smith.