Next: graph_assign Up: MacAnova Help File Previous: graphs   Contents

GRAPHWINDOWS

Keywords: plotting, syntax
A special variable GRAPHWINDOWS is always defined in MacAnova.  It is a
structure (see topic 'structures') with a component for each possible
graphics window.  In the DOS version and non-windowed Unix/Linux
versions, GRAPHWINDOWS has only one component.

Each component of GRAPHWINDOWS is either a GRAPH variable or is NULL.
When it is a GRAPH variable, it encapsulates everything used to draw the
plot in the corresponding window (see topic 'variables').

In windowed versions, when you close a graphics window, the
corresponding component of GRAPHWINDOWS is set to NULL.

The name of GRAPHWINDOWS[I] (component I of GRAPHWINDOWS), where I is a
positive integer, is one of the following:
   Name                 Meaning
  Empty_I       GRAPHWINDOWS[I] is NULL
  Graph_I       GRAPHWINDOWS[I] is a GRAPH variable
  LASTPLOT      GRAPHWINDOWS[I] is a GRAPH variable that is identical to
                GRAPH variable LASTPLOT which is normally created as a
                "side effect" every time a plot is drawn.

Thus
  Cmd> compnames(GRAPHWINDOWS)
summarizes the status of all the windows.  See compnames().

If the name of GRAPHWINDOWS[I] is LASTPLOT and you plot to window J !=
I, the name of GRAPHWINDOWS[I] is changed to Graph_I and GRAPHWINDOWS[J]
is given name LASTPLOT.

After a plotting command with keyword phrase 'keep:F', GRAPHWINDOWS[I]
becomes a NULL with name Empty_I.  If LASTPLOT exists, it doesn't
change.

When the name of GRAPHWINDOWS[I] is LASTPLOT, neither LASTPLOT <- var or
delete(LASTPLOT) affect the contents of GRAPHWINDOWS[I] but its name
automatically becomes Graph_I since it can no longer be guaranteed to be
the same as LASTPLOT.

delete(GRAPHWINDOWS) does not remove GRAPHWINDOWS but replaces all of
its components by NULL, without changing what is actually displayed in
any graphics window.  See delete().

You can also assign to components of GRAPHWINDOWS.  For details see
topic 'graph_assign'.  Briefly, the behavior is as follows.

GRAPHWINDOWS[I] <- NULL makes component I of GRAPHWINDOWS NULL without
  changing what is displayed or affecting LASTPLOT.

GRAPHWINDOWS[I] <- graphVar, where graphVar is a GRAPH variable, makes
  GRAPHWINDOWS[I] identical to graphVar and displays its new contents in
  graphics window I.  GRAPH variable LASTPLOT is set identical to
  graphVar and GRAPHWINDOWS[I] is renamed LASTPLOT.

GRAPHWINDOWS[I] <- structure(graphics key words) modifies or replaces
  component GRAPHWINDOWS[I] and displays it in graphics window I.  GRAPH
  variable LASTPLOT is set identical to GRAPHWINDOWS[i] which is renamed
  LASTPLOT.

GRAPHWINDOWS[I] can be NULL for one of three reasons: (a) Nothing has
been drawn in the window or it has been closed; (b) keyword phrase
'keep:F' was used when the graph in the window was drawn; or (c) the
graph variable has been cleared, either by delete(GRAPHWINDOWS) or by
GRAPHWINDOWS[I] <- NULL.

By default, functions save() and asciisave() save GRAPHWINDOWS as part
of the saved workspace, although this can be suppressed by keyword
phrase 'graphwind:F'.  When the saved workspace is restored,
GRAPHWINDOWS is restored.  In windowed versions, the restored graphs are
redrawn, replacing any existing graphs (see restore()).  The names of
the restored components are all either Empty_I or Graph_I, even if one
of the original components of GRAPHWINDOWS was named LASTPLOT.

See topic 'graphs' and 'graph_keys' for general information about
plotting in MacAnova.


Gary Oehlert 2003-01-15