postscript               package:base               R Documentation

_P_o_s_t_S_c_r_i_p_t _G_r_a_p_h_i_c_s

_D_e_s_c_r_i_p_t_i_o_n:

     `postscript' starts the graphics device driver for producing
     PostScript graphics.

     The auxiliary function `ps.options' can be used to set and view
     (if called without arguments) default values for the arguments to
     `postscript'.

_U_s_a_g_e:

     postscript(file = ifelse(onefile, "Rplots.ps", "Rplot
                onefile = TRUE,
                paper, family, bg, fg, width, height, horizontal, pointsize,
                pagecentre, print.it, command))

     ps.options(paper, horizontal, width, height, family, pointsize, bg, fg,
                onefile = TRUE, print.it = FALSE, append = FALSE,
                reset = FALSE, override.check = FALSE)
     .PostScript.Options

_A_r_g_u_m_e_n_t_s:

    file: a character string giving the name of the file.  If it is
          `""', the output is piped to the command given by the
          argument `command'. If it is `"|cmd"', the output is piped to
          the command given by `cmd'.

          For use with `onefile=FALSE' give a `printf' format such as
          `"Rplot%d.fig"' (the default in that case). 

     ...: further options for `postscript()' :

   paper: the size of paper in the printer.  The choices are `"a4"',
          `"letter"', `"legal"' and `"executive"' (and these can be
          capitalized). Also, `"special"' can be used, when the `width'
          and `height' specify the paper size.  A further choice is
          `"default"', which is the default.  If this is selected, the
          papersize is taken from the option `"papersize"' if that is
          set and to `"a4"' if it is unset or empty.

horizontal: the orientation of the printed image, a logical. Defaults
          to true, that is landscape orientation.

width, height: the width and height of the graphics region in inches.
          The default is to use the entire page less a 0.25 inch
          border.

  family: the font family to be used. This must be one of
          `"AvantGarde"', `"Bookman"', `"Courier"', `"Helvetica"',
          `"Helvetica-Narrow"', `"NewCenturySchoolbook"', `"Palatino"'
          or `"Times"'.

pointsize: the default point size to be used.

      bg: the default background color to be used.

      fg: the default foreground color to be used.

 onefile: logical: if true (the default) allow multiple figures in one
          file. If false, generate a file number containing the page
          number and give EPSF header and no `DocumentMedia' comment.

pagecentre: logical: should the device region be centred on the page:
          defaults to true.

print.it: logical: should the file be printed when the device is
          closed?  (This only applies if `file' is a real file name.)

 command: the command to be used for ``printing''. Defaults to option
          `"printcmd"'; this can also be selected as `"default"'.

  append: logical; currently disregarded; just there for compatibility
          reasons.

_D_e_t_a_i_l_s:

     `postscript(..)' opens the file `file' and the PostScript commands
     needed to plot any graphics requested are stored in that file.
     This file can then be printed on a suitable device to obtain hard
     copy.

     A postscript plot can be printed via `postscript' in two ways.

        1.  Setting `print.it = TRUE' causes the command given in
           argument `command' to be called with argument `"file"' when
           the device is closed. Note that the plot file is not deleted
           unless command arranges to delete it.

        2.  `file=""' or `file="|cmd"' can be used to print using a
           pipe on systems that support `popen'.

     The postscript produced by R is EPS (Encapsulated PostScript)
     compatible, and can be included into other documents, e.g. into
     LaTeX, using `\includegraphics{<filename>}'. For use in this way
     you will probably want to set `horizontal=FALSE, onefile=FALSE,
     paper="special"'.

_S_e_e _A_l_s_o:

     `Devices', {`check.options' which is called from both `ps.options'
     and `postscript'}.

_E_x_a_m_p_l_e_s:

     # open the file "foo.ps" for graphics output
     postscript("foo.ps")
     # produce the desired graph(s)
     dev.off()              # turn off the postscript device
     postscript("|lp -dlw")
     # produce the desired graph(s)
     dev.off()              # plot will appear on printer



     stopifnot(unlist(ps.options()) == unlist(.PostScript.Options))
     ps.options(bg = "pink")
     str(ps.options(reset = TRUE))

     ### --- error checking of arguments: ----
     ps.options(width=0:12, onefile=0, bg=pi)
     # override the check for 'onefile', but not the others:
     str(ps.options(width=0:12, onefile=1, bg=pi, override.check = c(F,T,F)))

