motif(options="", ...)
Do not destroy the S-PLUS graphics window through a window manager supplied menu; if you no longer want the window, use the dev.off function.
If you get the error:
X11 Toolkit Error : Can't Open display
while trying to start the motif graphics device, there are two likely causes of the problem: Your DISPLAY environment variable may be set incorrectly (or not set at all), and/or the machine that you are running S-PLUS on does not have access to your X11 server.
First, make sure your DISPLAY variable is set correctly. Exit S-PLUS (with the q function) and type the following (for the UNIX C-Shell):
setenv DISPLAY machinename:displaynumber.screennumber
where machinename is the name of the machine running the X11 server (the computer you are sitting in front of), and displaynumber and screennumber designate the display and screen of that machine. In most cases, both of these numbers will be "0". For example, if you are sitting in front of a workstation named "fay", which has one X11 display and one screen, you will want to type:
setenv DISPLAY fay:0.0
(If you do not know the name of the machine that is running the X11 server, and you are running S-PLUS on the same machine, you may substitute "unix" for the name of the machine. Also, note that the display may be specified as an option to the motif function. The S-PLUS command:
motif("-display fay:0.0")
will attempt to show its graphics window on "fay's" X11 server.)
If you are running S-PLUS and the X11 server on different machines, the steps above may not be enough to allow you to access your display. The machine running S-PLUS must have access to the X11 server. To accomplish this, type the following at a UNIX shell prompt on the machine running the X11 server:
xhost + machinename
where machinename is the name of the machine running S-PLUS. For example, if you are running S-PLUS on a computer named "donna" and are sitting in front of a computer named "fay", you will want to type
xhost + donna
at a shell prompt on "fay", to which you should get the response:
donna being added to access control list
(Note that the use of xhost supercedes "MIT-MAGIC-COOKIE" security. If you wish to abide by that system, consult your X11 documentation, or your system administrator for information on how to allow remote hosts access to X11 servers using xauth.)
If, after following the steps above, you are still unable to gain display access, consult your X11 documentation, or your system administrator.
In the example below, we show how to make an S-PLUS graphics window when remotely logged in on a machine named "cyclops" from a machine named "betty" running X11. There will be two graphics fonts, cex=1 will give you font0 (10 point helvetica, Roman style). The last entry ("Font") makes the command buttons and menus use the font name "fixed".
If the X11 resource database is properly set up, there is seldom a need to pass options to the motif command. The Customizing Your S-PLUS Session chapter of The S-PLUS User's Manual describes how to set up the X11 resource database.
Quercia, V. and O'Reilly, T. (1988) X Window System User's Guide. O'Reilly & Associates, Inc.
The "Window System Details" and "Customizing Your S-PLUS Session" chapters of The S-PLUS User's Manual.
The S-PLUS Installation and Maintenance Manual.
{betty}% xhost + cyclops # Run this command on betty, the X server machine. {betty}% rlogin cyclops {cyclops}% Splus X11.betty <- c("-display betty:0.0", "-xrm 'sgraphMotif*defaultFont:0'", "-xrm 'sgraphMotif*fonts:*helvetica-*-R-*-10-* *helvetica-*-R-*-14-*'") motif(X11.betty)# another call to motif; puts the graphics window in the upper-left corner motif(c("-d betty:0", "-geometry +0+0))