next up previous contents
Next: 34.49.55 Pslatex Up: 34.49 Terminal Previous: 34.49.53 Png

34.49.54 Postscript

Several options may be set in the postscript driver.

Syntax:

     set terminal postscript {<mode>} {enhanced | noenhanced}
                             {color | monochrome} {solid | dashed}
                             {<duplexing>}
                             {"<fontname>"} {<fontsize>}

where $<$mode$>$ is landscape, portrait, eps or default; solid draws all plots with solid lines, overriding any dashed patterns; $<$duplexing$>$ is defaultplex, simplex or duplex ("duplexing" in PostScript is the ability of the printer to print on both sides of the same page -- don't set this if your printer can't do it); enhanced activates the "enhanced PostScript" features (subscripts, superscripts and mixed fonts); "$<$fontname$>$" is the name of a valid PostScript font; and $<$fontsize$>$ is the size of the font in PostScript points.

default mode sets all options to their defaults: landscape, monochrome, dashed, defaultplex, noenhanced, "Helvetica" and 14pt.

Default size of a PostScript plot is 10 inches wide and 7 inches high.

eps mode generates EPS (Encapsulated PostScript) output, which is just regular PostScript with some additional lines that allow the file to be imported into a variety of other applications. (The added lines are PostScript comment lines, so the file may still be printed by itself.) To get EPS output, use the eps mode and make only one plot per file. In eps mode the whole plot, including the fonts, is reduced to half of the default size.

Examples:

     set terminal postscript default       # old postscript
     set terminal postscript enhanced      # old enhpost
     set terminal postscript landscape 22  # old psbig
     set terminal postscript eps 14        # old epsf1
     set terminal postscript eps 22        # old epsf2
     set size 0.7,1.4; set term post portrait color "Times-Roman" 14

Linewidths and pointsizes may be changed with set linestyle.

The postscript driver supports about 70 distinct pointtypes, selectable through the pointtype option on plot and set linestyle.

Several possibly useful files about gnuplot's PostScript are included in the /docs/ps subdirectory of the gnuplot distribution and at the distribution sites. These are "ps_symbols.gpi" (a gnuplot command file that, when executed, creates the file "ps_symbols.ps" which shows all the symbols available through the postscript terminal), "ps_guide.ps" (a PostScript file that contains a summary of the enhanced syntax and a page showing what the octal codes produce with text and symbol fonts) and "ps_file.doc" (a text file that contains a discussion of the organization of a PostScript file written by gnuplot).

A PostScript file is editable, so once gnuplot has created one, you are free to modify it to your heart's desire. See the "editing postscript" section for some hints. Enhanced postscript

Enhanced Text Control Codes
Control Examples Explanation
^ a^x superscript
_ a_x subscript
@ @x or a@^b_c phantom box (occupies no width)
& &{space} inserts space of specified length

Braces can be used to place multiple-character text where a single character is expected (e.g., 2^{10}). To change the font and/or size, use the full form: {/[fontname][=fontsize $\vert$ *fontscale] text}. Thus {/Symbol=20 G} is a 20-point GAMMA) and {/*0.75 K} is a K at three-quarters of whatever fontsize is currently in effect. (The '/' character MUST be the first character after the '{'.)

If the encoding vector has been changed by set encoding, the default encoding vector can be used instead by following the slash with a dash. This is unnecessary if you use the Symbol font, however -- since /Symbol uses its own encoding vector, gnuplot will not apply any other encoding vector to it.

The phantom box is useful for a@^b_c to align superscripts and subscripts but does not work well for overwriting an accent on a letter. (To do the latter, it is much better to use set encoding iso_8859_1 to change to the ISO Latin-1 encoding vector, which contains a large variety of letters with accents or other diacritical marks.) Since the box is non-spacing, it is sensible to put the shorter of the subscript or superscript in the box (that is, after the @).

Space equal in length to a string can be inserted using the '&' character. Thus

       'abc&{def}ghi'

would produce
       'abc   ghi'.

You can access special symbols numerically by specifying $\backslash$character-code (in octal), e.g., {/Symbol $\backslash$245} is the symbol for infinity.

You can escape control characters using $\backslash$, e.g., $\backslash$$\backslash$, $\backslash${, and so on.

But be aware that strings in double-quotes are parsed differently than those enclosed in single-quotes. The major difference is that backslashes may need to be doubled when in double-quoted strings.

Examples (these are hard to describe in words -- try them!):

     set xlabel 'Time (10^6 {/Symbol m}s)'
     set title '{/Symbol=18 \362@_{/=9.6 0}^{/=12 x}} \
                {/Helvetica e^{-{/Symbol m}^2/2} d}{/Symbol m}'

The file "ps_guide.ps" in the /docs/ps subdirectory of the gnuplot source distribution contains more examples of the enhanced syntax. Editing postscript The PostScript language is a very complex language -- far too complex to describe in any detail in this document. Nevertheless there are some things in a PostScript file written by gnuplot that can be changed without risk of introducing fatal errors into the file.

For example, the PostScript statement "/Color true def" (written into the file in response to the command set terminal postscript color), may be altered in an obvious way to generate a black-and-white version of a plot. Similarly line colors, text colors, line weights and symbol sizes can also be altered in straight-forward ways. Text (titles and labels) can be edited to correct misspellings or to change fonts. Anything can be repositioned, and of course anything can be added or deleted, but modifications such as these may require deeper knowledge of the PostScript language.

The organization of a PostScript file written by gnuplot is discussed in the text file "ps_file.doc" in the /docs/ps subdirectory.


next up previous contents
Next: 34.49.55 Pslatex Up: 34.49 Terminal Previous: 34.49.53 Png
Shigeharu TAKENO
2002年 11月 16日