[6323] in s-news-athena

home help back first fref pref prev next nref lref last post

Re: Interactive preparation of presentation graphics from S

daemon@ATHENA.MIT.EDU (Alan M. Zaslavsky)
Tue Jan 31 09:51:15 1995

Date: Tue, 31 Jan 95 09:08:57 EST
From: zaslavsk@hustat.harvard.edu (Alan M. Zaslavsky)
To: charles@Playfair.Stanford.EDU, bates@stat.wisc.edu
Cc: s-news@utstat.toronto.edu


>>>>> Charles Roosen  <charles@Playfair.Stanford.EDU> writes:
> For example, what I'd like in S is full object oriented graphics
> which can be modified dynamically.  ...

bates@stat.wisc.edu (Douglas Bates):
> A few years ago I suggested that it may be possible to add the power
> of interactive graphical editing to S graphics cheaply by writing an S
> device driver for a program like "idraw".   ...

I would like to draw people's attention to the fig() device driver,
written by Peter Dalgaard and Martin Maechler.  This produces output
that can be edited with xfig (a free utility) and then output into a
variety of formats including PostScript, LaTeX with eepic, etc.  This
sometimes breaks on very complicated plots but it is still quite
useful.  Some of the design decisions made in fig() do not precisely
correspond to those made in writing postscript(),so the appearance of
the plots is not exactly the same.  There may be some room for
polishing here.

Doug's suggestion of writing drivers for other graphics formats is a
welcome one.  Another utility that people should be aware of is the
psfrag style for LaTeX, which allows fragments of LaTeX (e.g. formulae)
to be written into label functions and then processed and included in
the PostScript inclusions in a LaTeX document.  (This is almost as
clumsy to use as it is to describe.)

I think there is another issue at work, however, which is that creating
graphics in an intermediate format and then editing it does not allow
for full flexibility and convenience in reproducing the graphic from
the start.  For example, I can produce a Fig file with fig(), then use
xfig to put on nicely placed labels and arrows, then output it to LaTeX
and put nice LaTeX equations into the axis labels by editing the
strings for the labels.  Now what happens when I want to recreate the
graphic with modified data?  Basically I have to start over from
scratch and do another bunch of key and mouse actions and text edits to
recreate my new graphic.

This suggests that more of the work has to go up front, with tools in S
that create S code.  It would be pretty easy to create a graphic
interface (using locate()) for adding elements to a graph, so that you
could (for example) place an arrow on an S graphic using key clicks and
have the corresponding arrows() call output to a file (or added to an
editable window).  (This particular example would not be too hard to
code in S.)

Other graphic editor functions such as moving or deleting graphical
elements are trickier, since the program would have to be able to
recognize what you are pointing at.  (You could look at the menu of
items corresponding to the series of graphics function calls that
created the elements in the graphic.)  Some thought would also have to
be given to how to specify objects in several different coordinate
systems.  For example, the x-axis label should always be halfway across
(if that's they way you like it) regardless of changing the scale of
the plot, whereas the arrow that points at the outlier should always
point at (1.4629,5.1039) where the point is, regardless of how that
point moves around in different coordinate systems when you rescale the
graphic (change the limits).

In order for all of this to work, you would need to have screen devices
(motif(), openlook(), etc.) that more precisely mimicked the appearance
of the postscript output than is now the case.

In any case, this is a different approach to the problem, but I think
it is more in the spirit of other S add-ons, namely that you try to
make it easy to use but also to have everything be available in S code
so you can modify and try again.

home help back first fref pref prev next nref lref last post