The R Project SVN R

Rev

Rev 27713 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27713 Rev 27943
1
\name{postscript}
1
\name{postscript}
2
\alias{postscript}
2
\alias{postscript}
3
\alias{ps.options}
3
\alias{ps.options}
4
%\alias{.PostScript.Options}
4
%\alias{.PostScript.Options}
5
\alias{.ps.prolog}
5
\alias{.ps.prolog}
-
 
6
\concept{encoding}
6
\title{PostScript Graphics}
7
\title{PostScript Graphics}
7
\description{
8
\description{
8
  \code{postscript} starts the graphics device driver for producing
9
  \code{postscript} starts the graphics device driver for producing
9
  PostScript graphics.
10
  PostScript graphics.
10
 
11
 
11
  The auxiliary function \code{ps.options} can be used to set and view
12
  The auxiliary function \code{ps.options} can be used to set and view
12
  (if called without arguments) default values for the arguments to
13
  (if called without arguments) default values for the arguments to
13
  \code{postscript}.
14
  \code{postscript}.
14
}
15
}
15
\synopsis{
16
\synopsis{
16
postscript(file = ifelse(onefile, "Rplots.ps", "Rplot\%03d.ps"),
17
postscript(file = ifelse(onefile, "Rplots.ps", "Rplot\%03d.ps"),
17
           onefile = TRUE, family, title = "R Graphics Output", \dots)
18
           onefile = TRUE, family, title = "R Graphics Output", \dots)
18
ps.options(\dots, reset = FALSE, override.check = FALSE)
19
ps.options(\dots, reset = FALSE, override.check = FALSE)
19
}
20
}
20
%% The definitive doc is the source :-)
21
%% The definitive doc is the source :-)
21
%% 	../../../main/devices.c  &   ../../../unix/devPS.c
22
%% 	../../../main/devices.c  &   ../../../unix/devPS.c
22
\usage{
23
\usage{
23
postscript(file = ifelse(onefile, "Rplots.ps", "Rplot\%03d.ps"),
24
postscript(file = ifelse(onefile, "Rplots.ps", "Rplot\%03d.ps"),
24
           onefile = TRUE,
25
           onefile = TRUE,
25
           paper, family, encoding, bg, fg,
26
           paper, family, encoding, bg, fg,
26
           width, height, horizontal, pointsize,
27
           width, height, horizontal, pointsize,
27
           pagecentre, print.it, command, title = "R Graphics Output")
28
           pagecentre, print.it, command, title = "R Graphics Output")
28
 
29
 
29
% paper, horizontal, width, height, family, pointsize, bg, fg)
30
% paper, horizontal, width, height, family, pointsize, bg, fg)
30
ps.options(paper, horizontal, width, height, family, encoding,
31
ps.options(paper, horizontal, width, height, family, encoding,
31
           pointsize, bg, fg,
32
           pointsize, bg, fg,
32
           onefile = TRUE, print.it = FALSE, append = FALSE,
33
           onefile = TRUE, print.it = FALSE, append = FALSE,
33
           reset = FALSE, override.check = FALSE)
34
           reset = FALSE, override.check = FALSE)
34
}
35
}
35
\arguments{
36
\arguments{
36
  \item{file}{a character string giving the name of the file.  If it is
37
  \item{file}{a character string giving the name of the file.  If it is
37
    \code{""}, the output is piped to the command given by
38
    \code{""}, the output is piped to the command given by
38
    the argument \code{command}.
39
    the argument \code{command}.
39
#ifdef unix
40
#ifdef unix
40
    If it is \code{"|cmd"}, the output is piped to the command given
41
    If it is \code{"|cmd"}, the output is piped to the command given
41
    by \file{cmd}.
42
    by \file{cmd}.
42
#endif
43
#endif
43
 
44
 
44
    For use with \code{onefile=FALSE} give a \code{printf} format such
45
    For use with \code{onefile=FALSE} give a \code{printf} format such
45
    as \code{"Rplot\%03d.ps"} (the default in that case).
46
    as \code{"Rplot\%03d.ps"} (the default in that case).
46
  }
47
  }
47
%  \item{\dots}{further options for \code{postscript()}.}
48
%  \item{\dots}{further options for \code{postscript()}.}
48
  \item{paper}{the size of paper in the printer.  The choices are
49
  \item{paper}{the size of paper in the printer.  The choices are
49
    \code{"a4"}, \code{"letter"}, \code{"legal"} and
50
    \code{"a4"}, \code{"letter"}, \code{"legal"} and
50
    \code{"executive"} (and these can be capitalized).
51
    \code{"executive"} (and these can be capitalized).
51
    Also, \code{"special"} can be used, when the \code{width}
52
    Also, \code{"special"} can be used, when the \code{width}
52
    and \code{height} specify the paper size.  A further choice is
53
    and \code{height} specify the paper size.  A further choice is
53
    \code{"default"}, which is the default.  If this is selected, the
54
    \code{"default"}, which is the default.  If this is selected, the
54
    papersize is taken from the option \code{"papersize"}
55
    papersize is taken from the option \code{"papersize"}
55
    if that is set and to \code{"a4"} if it is unset or empty.}
56
    if that is set and to \code{"a4"} if it is unset or empty.}
56
  \item{horizontal}{the orientation of the printed image, a
57
  \item{horizontal}{the orientation of the printed image, a
57
    logical. Defaults to true, that is landscape orientation on paper
58
    logical. Defaults to true, that is landscape orientation on paper
58
    sizes with width less than height.}
59
    sizes with width less than height.}
59
  \item{width, height}{the width and height of the graphics region in
60
  \item{width, height}{the width and height of the graphics region in
60
    inches.  The default is to use the entire page less a 0.25 inch
61
    inches.  The default is to use the entire page less a 0.25 inch
61
    border on each side.}
62
    border on each side.}
62
  \item{family}{the font family to be used.  EITHER a single character
63
  \item{family}{the font family to be used.  EITHER a single character
63
    string OR a character vector of length
64
    string OR a character vector of length
64
    four or five.  See the section \sQuote{Families}.}
65
    four or five.  See the section \sQuote{Families}.}
65
  \item{encoding}{the name of an encoding file. Defaults to
66
  \item{encoding}{the name of an encoding file. Defaults to
66
#ifdef unix
67
#ifdef unix
67
"ISOLatin1.enc"
68
"ISOLatin1.enc"
68
#endif
69
#endif
69
#ifdef windows
70
#ifdef windows
70
"WinAnsi.enc"
71
"WinAnsi.enc"
71
#endif
72
#endif
72
    in the \file{R\_HOME/afm} directory, which is used
73
    in the \file{R\_HOME/afm} directory, which is used
73
    if the path does not contain a path separator.  An extension
74
    if the path does not contain a path separator.  An extension
74
    \code{".enc"} can be omitted.}
75
    \code{".enc"} can be omitted.}
75
  \item{pointsize}{the default point size to be used.}
76
  \item{pointsize}{the default point size to be used.}
76
  \item{bg}{the default background color to be used.
77
  \item{bg}{the default background color to be used.
77
    If \code{"transparent"} (or an equivalent specification), no
78
    If \code{"transparent"} (or an equivalent specification), no
78
    background is painted.}
79
    background is painted.}
79
  \item{fg}{the default foreground color to be used.}
80
  \item{fg}{the default foreground color to be used.}
80
  \item{onefile}{logical: if true (the default) allow multiple figures
81
  \item{onefile}{logical: if true (the default) allow multiple figures
81
    in one file.  If false, generate a file name containing the page
82
    in one file.  If false, generate a file name containing the page
82
    number and use an EPSF header and no \code{DocumentMedia} comment.}
83
    number and use an EPSF header and no \code{DocumentMedia} comment.}
83
  \item{pagecentre}{logical: should the device region be centred on the
84
  \item{pagecentre}{logical: should the device region be centred on the
84
    page: defaults to true.}
85
    page: defaults to true.}
85
  \item{print.it}{logical: should the file be printed when the device is
86
  \item{print.it}{logical: should the file be printed when the device is
86
    closed?  (This only applies if \code{file} is a real file name.)}
87
    closed?  (This only applies if \code{file} is a real file name.)}
87
  \item{command}{the command to be used for \dQuote{printing}.  Defaults to
88
  \item{command}{the command to be used for \dQuote{printing}.  Defaults to
88
    option \code{"printcmd"}; this can also be selected as
89
    option \code{"printcmd"}; this can also be selected as
89
    \code{"default"}.}
90
    \code{"default"}.}
90
  \item{append}{logical; currently \bold{disregarded}; just there for
91
  \item{append}{logical; currently \bold{disregarded}; just there for
91
    compatibility reasons.}
92
    compatibility reasons.}
92
  \item{reset, override.check}{logical arguments passed to
93
  \item{reset, override.check}{logical arguments passed to
93
    \code{\link{check.options}}.  See the Examples.}
94
    \code{\link{check.options}}.  See the Examples.}
94
  \item{title}{title string to embed in the file.}
95
  \item{title}{title string to embed in the file.}
95
}
96
}
96
\details{
97
\details{
97
  \code{postscript} opens the file \code{file} and the PostScript
98
  \code{postscript} opens the file \code{file} and the PostScript
98
  commands needed to plot any graphics requested are stored in that
99
  commands needed to plot any graphics requested are stored in that
99
  file.  This file can then be printed on a suitable device to obtain
100
  file.  This file can then be printed on a suitable device to obtain
100
  hard copy.
101
  hard copy.
101
 
102
 
102
  A postscript plot can be printed via \code{postscript} in two ways.
103
  A postscript plot can be printed via \code{postscript} in two ways.
103
  \enumerate{
104
  \enumerate{
104
    \item Setting \code{print.it = TRUE} causes the command given in
105
    \item Setting \code{print.it = TRUE} causes the command given in
105
    argument \code{command} to be called with argument \code{"file"}
106
    argument \code{command} to be called with argument \code{"file"}
106
    when the device is closed.
107
    when the device is closed.
107
    Note that the plot file is not deleted unless \code{command} arranges to
108
    Note that the plot file is not deleted unless \code{command} arranges to
108
    delete it.
109
    delete it.
109
 
110
 
110
    \item \code{file=""} or \code{file="|cmd"} can be used to print
111
    \item \code{file=""} or \code{file="|cmd"} can be used to print
111
    using a pipe on systems that support \file{popen}.  Failure to open the
112
    using a pipe on systems that support \file{popen}.  Failure to open the
112
    command will probably be reported to the terminal but not to
113
    command will probably be reported to the terminal but not to
113
    \file{popen}, in which case close the device by \code{dev.off}
114
    \file{popen}, in which case close the device by \code{dev.off}
114
    immediately.
115
    immediately.
115
  }
116
  }
116
#ifdef windows
117
#ifdef windows
117
  Only the first of these will work on Windows, and the default
118
  Only the first of these will work on Windows, and the default
118
  \code{"printcmd"} is empty and will give an error if \code{print.it=TRUE}
119
  \code{"printcmd"} is empty and will give an error if \code{print.it=TRUE}
119
  is used.  Suitable commands to spool a PostScript file to a printer
120
  is used.  Suitable commands to spool a PostScript file to a printer
120
  can be found in \file{RedMon} suite available from
121
  can be found in \file{RedMon} suite available from
121
  \url{http://www.cs.wisc.edu/~ghost/index.html}.  The command will be run
122
  \url{http://www.cs.wisc.edu/~ghost/index.html}.  The command will be run
122
  in a minimized window.   GSView 4.x provides
123
  in a minimized window.   GSView 4.x provides
123
  \file{gsprint.exe} which may be even more convenient (it requires
124
  \file{gsprint.exe} which may be even more convenient (it requires
124
  GhostScript version 6.0 or later).
125
  GhostScript version 6.0 or later).
125
#endif
126
#endif
126
 
127
 
127
  The postscript produced by \R is EPS (\emph{Encapsulated PostScript})
128
  The postscript produced by \R is EPS (\emph{Encapsulated PostScript})
128
  compatible, and can be included into other documents, e.g., into
129
  compatible, and can be included into other documents, e.g., into
129
  LaTeX, using \code{\includegraphics{<filename>}}.  For use in this way
130
  LaTeX, using \code{\includegraphics{<filename>}}.  For use in this way
130
  you will probably want to set \code{horizontal = FALSE, onefile = FALSE,
131
  you will probably want to set \code{horizontal = FALSE, onefile = FALSE,
131
    paper = "special"}.
132
    paper = "special"}.
132
 
133
 
133
  Most of the PostScript prologue used is taken from the \R character
134
  Most of the PostScript prologue used is taken from the \R character
134
  vector \code{.ps.prolog}.  This is marked in the output, and can be
135
  vector \code{.ps.prolog}.  This is marked in the output, and can be
135
  changed by changing that vector.  (This is only advisable for
136
  changed by changing that vector.  (This is only advisable for
136
  PostScript experts: the standard version is in
137
  PostScript experts: the standard version is in
137
  \code{namespace:graphics}.)
138
  \code{namespace:graphics}.)
138
 
139
 
139
  \code{ps.options} needs to be called before calling \code{postscript},
140
  \code{ps.options} needs to be called before calling \code{postscript},
140
  and the default values it sets can be overridden by supplying
141
  and the default values it sets can be overridden by supplying
141
  arguments to \code{postscript}.
142
  arguments to \code{postscript}.
142
}
143
}
143
 
144
 
144
\section{Families}{
145
\section{Families}{
145
  The argument \code{family} specifies the font family to be used.
146
  The argument \code{family} specifies the font family to be used.
146
  In normal use it is one of \code{"AvantGarde"},
147
  In normal use it is one of \code{"AvantGarde"},
147
  \code{"Bookman"}, \code{"Courier"}, \code{"Helvetica"},
148
  \code{"Bookman"}, \code{"Courier"}, \code{"Helvetica"},
148
  \code{"Helvetica-Narrow"}, \code{"NewCenturySchoolbook"},
149
  \code{"Helvetica-Narrow"}, \code{"NewCenturySchoolbook"},
149
  \code{"Palatino"} or \code{"Times"}, and refers to the standard
150
  \code{"Palatino"} or \code{"Times"}, and refers to the standard
150
  Adobe PostScript fonts of those names which are included (or cloned)
151
  Adobe PostScript fonts of those names which are included (or cloned)
151
  in all common PostScript devices.
152
  in all common PostScript devices.
152
 
153
 
153
  Many PostScript emulators (including those based on
154
  Many PostScript emulators (including those based on
154
  \code{ghostscript}) use the URW equivalents of these fonts, which are
155
  \code{ghostscript}) use the URW equivalents of these fonts, which are
155
  \code{"URWGothic"}, \code{"URWBookman"}, \code{"NimbusMon"},
156
  \code{"URWGothic"}, \code{"URWBookman"}, \code{"NimbusMon"},
156
  \code{"NimbusSan"}, \code{"NimbusSanCond"}, \code{"CenturySch"},
157
  \code{"NimbusSan"}, \code{"NimbusSanCond"}, \code{"CenturySch"},
157
  \code{"URWPalladio"} and \code{"NimbusRom"} respectively.  If your
158
  \code{"URWPalladio"} and \code{"NimbusRom"} respectively.  If your
158
  PostScript device is using URW fonts, you will obtain access to more
159
  PostScript device is using URW fonts, you will obtain access to more
159
  characters and more appropriate metrics by using these names.  To make
160
  characters and more appropriate metrics by using these names.  To make
160
  these easier to remember, \code{"URWHelvetica" == "NimbusSan"} and
161
  these easier to remember, \code{"URWHelvetica" == "NimbusSan"} and
161
  \code{"URWTimes" == "NimbusRom"} are also supported.
162
  \code{"URWTimes" == "NimbusRom"} are also supported.
162
 
163
 
163
  It is also possible to specify \code{family="ComputerModern"}. This
164
  It is also possible to specify \code{family="ComputerModern"}. This
164
  is intended to use with the Type 1 versions of the TeX CM fonts.  It
165
  is intended to use with the Type 1 versions of the TeX CM fonts.  It
165
  will normally be possible to include such output in TeX or LaTeX
166
  will normally be possible to include such output in TeX or LaTeX
166
  provided it is processed with \code{dvips -Ppfb -j0} or the equivalent
167
  provided it is processed with \code{dvips -Ppfb -j0} or the equivalent
167
  on your system. (\code{-j0} turns off font subsetting.)
168
  on your system. (\code{-j0} turns off font subsetting.)
168
  
169
  
169
  If the second form of argument \code{"family"} is used, it should be a
170
  If the second form of argument \code{"family"} is used, it should be a
170
  character vector of four or five paths to Adobe Font Metric files for
171
  character vector of four or five paths to Adobe Font Metric files for
171
  the regular, bold, italic, bold italic and (optionally) symbol fonts to
172
  the regular, bold, italic, bold italic and (optionally) symbol fonts to
172
  be used.  If these paths do not contain the file separator, they are
173
  be used.  If these paths do not contain the file separator, they are
173
  taken to refer to files in the \R directory \file{R\_HOME/afm}.  Thus the
174
  taken to refer to files in the \R directory \file{R\_HOME/afm}.  Thus the
174
  default Helvetica family can be specified by \code{family =
175
  default Helvetica family can be specified by \code{family =
175
    c("hv______.afm",
176
    c("hv______.afm",
176
    "hvb_____.afm", "hvo_____.afm", "hvbo____.afm", "sy______.afm")}.
177
    "hvb_____.afm", "hvo_____.afm", "hvbo____.afm", "sy______.afm")}.
177
  It is the user's responsibility to check that suitable fonts are made
178
  It is the user's responsibility to check that suitable fonts are made
178
  available, and that they contain the needed characters when
179
  available, and that they contain the needed characters when
179
  re-encoded.  The fontnames used are taken from the \code{FontName}
180
  re-encoded.  The fontnames used are taken from the \code{FontName}
180
  fields of the afm files.  The software including the PostScript plot
181
  fields of the afm files.  The software including the PostScript plot
181
  file should either embed the font outlines (usually from \file{.pfb}
182
  file should either embed the font outlines (usually from \file{.pfb}
182
  or \file{.pfa} files) or use DSC comments to instruct the print
183
  or \file{.pfa} files) or use DSC comments to instruct the print
183
  spooler to do so.
184
  spooler to do so.
184
}
185
}
185
 
186
 
186
\section{Encodings}{
187
\section{Encodings}{
187
  Encodings describe which glyphs are used to display the character codes
188
  Encodings describe which glyphs are used to display the character codes
188
  (in the range 0--255).  By default \R uses ISOLatin1 encoding, and
189
  (in the range 0--255).  By default \R uses ISOLatin1 encoding, and
189
  the examples for \code{\link{text}} are in that encoding.  However,
190
  the examples for \code{\link{text}} are in that encoding.  However,
190
  the encoding used on machines running \R may well be different, and by
191
  the encoding used on machines running \R may well be different, and by
191
  using the \code{encoding} argument the glyphs can be matched to
192
  using the \code{encoding} argument the glyphs can be matched to
192
  encoding in use.
193
  encoding in use.
193
 
194
 
194
  None of this will matter if only ASCII characters (codes 32--126) are
195
  None of this will matter if only ASCII characters (codes 32--126) are
195
  used as all the encodings agree over that range.  Some encodings are
196
  used as all the encodings agree over that range.  Some encodings are
196
  supersets of ISOLatin1, too.  However, if accented and special
197
  supersets of ISOLatin1, too.  However, if accented and special
197
  characters do not come out as you expect, you may need to change the
198
  characters do not come out as you expect, you may need to change the
198
  encoding.  Three other encodings are supplied with \R:
199
  encoding.  Three other encodings are supplied with \R:
199
  \code{"WinAnsi.enc"} and \code{"MacRoman.enc"} correspond to the
200
  \code{"WinAnsi.enc"} and \code{"MacRoman.enc"} correspond to the
200
  encodings normally used on Windows and MacOS (at least by Adobe), and
201
  encodings normally used on Windows and MacOS (at least by Adobe), and
201
  \code{"PDFDoc.enc"} is the first 256 characters of the Unicode
202
  \code{"PDFDoc.enc"} is the first 256 characters of the Unicode
202
  encoding, the standard for PDF.
203
  encoding, the standard for PDF.
203
 
204
 
204
  If you change the encoding, it is your responsibility to ensure that
205
  If you change the encoding, it is your responsibility to ensure that
205
  the PostScript font contains the glyphs used.  One issue here is the Euro
206
  the PostScript font contains the glyphs used.  One issue here is the Euro
206
  symbol which is in the WinAnsi and MacRoman encodings but may well not
207
  symbol which is in the WinAnsi and MacRoman encodings but may well not
207
  be in the PostScript fonts.  (It is in the URW variants; it is not in
208
  be in the PostScript fonts.  (It is in the URW variants; it is not in
208
  the supplied Adobe Font Metric files.)
209
  the supplied Adobe Font Metric files.)
209
 
210
 
210
  There is one exception.  Character 45 (\code{"-"}) is always set
211
  There is one exception.  Character 45 (\code{"-"}) is always set
211
  as minus (its value in Adobe ISOLatin1) even though it is hyphen in
212
  as minus (its value in Adobe ISOLatin1) even though it is hyphen in
212
  the other encodings.  Hyphen is available as character 173 (octal
213
  the other encodings.  Hyphen is available as character 173 (octal
213
  0255) in ISOLatin1.
214
  0255) in ISOLatin1.
214
}
215
}
215
\references{
216
\references{
216
  Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
217
  Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
217
  \emph{The New S Language}.
218
  \emph{The New S Language}.
218
  Wadsworth \& Brooks/Cole.
219
  Wadsworth \& Brooks/Cole.
219
}
220
}
220
\seealso{
221
\seealso{
221
  \code{\link{Devices}},
222
  \code{\link{Devices}},
222
  {\code{\link{check.options}} which is called from both
223
  {\code{\link{check.options}} which is called from both
223
    \code{ps.options} and \code{postscript}}.
224
    \code{ps.options} and \code{postscript}}.
224
}
225
}
225
\author{
226
\author{
226
  Support for Computer Modern fonts is based on a contribution by
227
  Support for Computer Modern fonts is based on a contribution by
227
  Brian D'Urso \email{durso@hussle.harvard.edu}.
228
  Brian D'Urso \email{durso@hussle.harvard.edu}.
228
}
229
}
229
\examples{
230
\examples{
230
\dontrun{
231
\dontrun{
231
# open the file "foo.ps" for graphics output
232
# open the file "foo.ps" for graphics output
232
postscript("foo.ps")
233
postscript("foo.ps")
233
# produce the desired graph(s)
234
# produce the desired graph(s)
234
dev.off()              # turn off the postscript device
235
dev.off()              # turn off the postscript device
235
#ifdef unix
236
#ifdef unix
236
postscript("|lp -dlw")
237
postscript("|lp -dlw")
237
# produce the desired graph(s)
238
# produce the desired graph(s)
238
dev.off()              # plot will appear on printer
239
dev.off()              # plot will appear on printer
239
#endif
240
#endif
240
#ifdef windows
241
#ifdef windows
241
options(printcmd='redpr -P"\\\\markov\\lw"')
242
options(printcmd='redpr -P"\\\\markov\\lw"')
242
postscript(file=tempfile("Rps."), print.it=TRUE)
243
postscript(file=tempfile("Rps."), print.it=TRUE)
243
# produce the desired graph(s)
244
# produce the desired graph(s)
244
dev.off()              # send plot file to the printer
245
dev.off()              # send plot file to the printer
245
#endif
246
#endif
246
 
247
 
247
# for URW PostScript devices
248
# for URW PostScript devices
248
postscript("foo.ps", family = "NimbusSan")
249
postscript("foo.ps", family = "NimbusSan")
249
 
250
 
250
## for inclusion in Computer Modern TeX documents, perhaps
251
## for inclusion in Computer Modern TeX documents, perhaps
251
postscript("cm_test.eps", width = 4.0, height = 3.0,
252
postscript("cm_test.eps", width = 4.0, height = 3.0,
252
           horizontal = FALSE, onefile = FALSE, paper = "special",
253
           horizontal = FALSE, onefile = FALSE, paper = "special",
253
           family = "ComputerModern")
254
           family = "ComputerModern")
254
## The resultant postscript file can be used by dvips -Ppfb -j0.
255
## The resultant postscript file can be used by dvips -Ppfb -j0.
255
 
256
 
256
## To test out encodings, you can use
257
## To test out encodings, you can use
257
TestChars <- function(encoding="ISOLatin1", family="URWHelvetica")
258
TestChars <- function(encoding="ISOLatin1", family="URWHelvetica")
258
{
259
{
259
    postscript(encoding=encoding, family=family)
260
    postscript(encoding=encoding, family=family)
260
    par(pty="s")
261
    par(pty="s")
261
    plot(c(0,15), c(0,15), type="n", xlab="", ylab="")
262
    plot(c(0,15), c(0,15), type="n", xlab="", ylab="")
262
    title(paste("Centred chars in encoding", encoding))
263
    title(paste("Centred chars in encoding", encoding))
263
    grid(15, 15, lty=1)
264
    grid(15, 15, lty=1)
264
    for(i in c(32:255)) {
265
    for(i in c(32:255)) {
265
	x <- i %% 16
266
	x <- i %% 16
266
	y <- i %/% 16
267
	y <- i %/% 16
267
	points(x, y, pch=i)
268
	points(x, y, pch=i)
268
    }
269
    }
269
    dev.off()
270
    dev.off()
270
}
271
}
271
## there will be many warnings. We use URW to get a complete enough
272
## there will be many warnings. We use URW to get a complete enough
272
## set of font metrics.
273
## set of font metrics.
273
TestChars()
274
TestChars()
274
TestChars("ISOLatin2")
275
TestChars("ISOLatin2")
275
TestChars("WinAnsi")
276
TestChars("WinAnsi")
276
}
277
}
277
\dontshow{
278
\dontshow{
278
xx <- seq(0, 7, length=701)
279
xx <- seq(0, 7, length=701)
279
yy <- sin(xx)/xx; yy[1] <- 1
280
yy <- sin(xx)/xx; yy[1] <- 1
280
plot(xx,yy)                     # produce the desired graph(s)
281
plot(xx,yy)                     # produce the desired graph(s)
281
}
282
}
282
 
283
 
283
ps.options(bg = "pink")
284
ps.options(bg = "pink")
284
utils::str(ps.options(reset = TRUE))
285
utils::str(ps.options(reset = TRUE))
285
 
286
 
286
### ---- error checking of arguments: ----
287
### ---- error checking of arguments: ----
287
ps.options(width=0:12, onefile=0, bg=pi)
288
ps.options(width=0:12, onefile=0, bg=pi)
288
# override the check for 'onefile', but not the others:
289
# override the check for 'onefile', but not the others:
289
utils::str(ps.options(width=0:12, onefile=1, bg=pi,
290
utils::str(ps.options(width=0:12, onefile=1, bg=pi,
290
                      override.check = c(FALSE,TRUE,FALSE)))
291
                      override.check = c(FALSE,TRUE,FALSE)))
291
}
292
}
292
\keyword{device}
293
\keyword{device}