shortcut for closing plots

Richard M. Heiberger rmh at temple.edu
Sun Sep 12 16:16:37 CEST 2004


As Stephen pointed out, your question is not precise enough to answer unless
we make some assumptions.

In S-Plus for Windows, this is what I do routinely to remove individual
plots from the GUI graphsheet.

In my .First I set the GUI graphics option to retain all graphs in the graphsheet

   guiSetOption(option.name = "AutoAddPages", value.string = "Every Graph")

(The option can also be set with the clickable menu:
  Options/Graph options.../Options/Auto Pages/Every Graph/OK
)

Then I define an S-Plus function 

   GSremove <- function(pages, sheet = "GSD2$Page")
      for(i in paste(sheet, pages, sep = ""))
	  guiRemove("GraphSheetPage", Name = i, ShiftLeft = F)

(GSD2 is the name chosen by S-Plus for the first graphsheet opened from the Commands
window and is therefore the default for the GSremove function.
If you have multiple sheets from the Commands window or from GUI graphics,
then you will need to use a different name in the sheet= argument.)

The GSremove function is one of the functions included in the HH library
    http://springeronline.com/0-387-40270-5
that comes with the book Statistical Analysis and Data Display that
Burt Holland and I just completed.

Then I do some work and produce many graphs in the graphsheet.
Say, for example, that I have pages 1,2,3,4,5,6,7,8,9,10 on the graphsheet GSD2.
I can click between them with the mouse on the tabs at the bottom of the graphsheet
or I can page through them with the Ctrl-PageUp and Ctrl-PageDown keys.
I wish to retain pages 4,7,10.  That is, I wish to remove pages 1,2,3,5,6,8,9.

Type in the GUI Commands window
    GSremove(1,2,3,5,6,8,9)

The indicated pages will go away.  This is much faster than right-clicking
"Delete Page" on each of the tabs for the pages I wish to remove.

I did not make this into an ESS function because the page numbers are never the
same from instance to instance and there is therefore no need to retain them in
an S-language myfile.s file.

I constructed the GSremove function by looking at the complete history in
    Window/History/Display
This window includes the command equivalent of GUI commands as well as typed commands.
The other history in
    Window/History/Commands
shows only typed commands.

Rich




More information about the ESS-help mailing list