next up previous contents index
Next: Editing postscript Up: Postscript Previous: Postscript   Contents   Index

Enhanced postscript

Several terminal types support an enhanced text mode in which additional formatting information is embedded in the text string.

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
~ ~a{.8-} overprints '-' on 'a', raised by .8
times the current fontsize

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 4#4 *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


would produce
       'abc   ghi'.

The '~ ' character causes the next character or bracketed text to be overprinted by the following character or bracketed text. The second text will be horizontally centered on the first. Thus '~ a/' will result in an 'a' with a slash through it. You can also shift the second text vertically by preceding the second text with a number, which will define the fraction of the current fontsize by which the text will be raised or lowered. In this case the number and text must be enclosed in brackets because more than one character is necessary. If the overprinted text begins with a number, put a space between the vertical offset and the text ('~ {abc}{.5 000}'); otherwise no space is needed ('~ {abc}{.5 -- }'). You can change the font for one or both strings ('~ a{.5 /*.2 o}' -- an 'a' with a one-fifth-size 'o' on top -- and the space between the number and the slash is necessary), but you can't change it after the beginning of the string. Neither can you use any other special syntax within either string. You can, of course, use control characters by escaping them (see below), such as '~ a{3#3^}'

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

You can escape control characters using 3#3, e.g., 3#33#3, 3#3{, 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 "" in the /docs/psdoc subdirectory of the gnuplot source distribution contains more examples of the enhanced syntax.

next up previous contents index
Next: Editing postscript Up: Postscript Previous: Postscript   Contents   Index
Ethan Merritt 2007-03-03