Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pmi432 / LR02 / Books / gnuplot 4.6 manual.pdf
Скачиваний:
59
Добавлен:
18.03.2015
Размер:
2.22 Mб
Скачать

112

gnuplot 4.6

Syntax:

set fontpath {"pathlist1" {"pathlist2"...}} show fontpath

Path names may be entered as single directory names, or as a list of path names separated by a platformspeci c path separator, eg. colon (':') on Unix, semicolon (';') on DOS/Windows/OS/2 platforms. The show fontpath, save and save set commands replace the platform-speci c separator with a space character (' ') for maximum portability. If a directory name ends with an exclamation mark ('!') also the subdirectories of this directory are searched for font les.

If the environmental variable GNUPLOT FONTPATH is set, its contents are appended to fontpath. If it is not set, a system dependent default value is used. It is set by testing several directories for existence when using the fontpath the rst time. Thus, the rst call of set fontpath, show fontpath, save fontpath, plot, or splot with embedded font les takes a little more time. If you want to save this time you may set the environmental variable GNUPLOT FONTPATH since probing is switched o , then. You can nd out which is the default fontpath by using show fontpath.

show fontpath prints the contents of the user-de ned fontpath and the system fontpath separately. However, the save and save set commands save only the user-speci ed parts of fontpath.

For terminal drivers that access fonts by lename via the gd library, the font search path is controlled by the environmental variable GDFONTPATH.

Format

The format of the tic-mark labels can be set with the set format command or with the set tics format or individual set faxisgtics format commands.

Syntax:

set format {<axes>} {"<format-string>"} set format {<axes>} {'<format-string>'} show format

where <axes> is either x, y, xy, x2, y2, z, cb or nothing (which applies the format to all axes). The following two commands are equivalent:

set format y "%.2f" set ytics format "%.2f"

The length of the string is restricted to 100 characters. The default format is "% g", but other formats such as "%.2f" or "%3.0em" are often desirable. The format "$%g$" is often desirable for LaTeX. If no format string is given, the format will be returned to the default. If the empty string "" is given, tics will have no labels, although the tic mark will still be plotted. To eliminate the tic marks, use unset xtics or set tics scale 0.

Newline (nn) and enhanced text markup is accepted in the format string. Use double-quotes rather than single-quotes in this case. See also syntax (p. 40). Characters not preceded by "%" are printed verbatim. Thus you can include spaces and labels in your format string, such as "%g m", which will put " m" after each number. If you want "%" itself, double it: "%g %%".

See also set xtics (p. 160) for more information about tic labels, and set decimalsign (p. 108) for how to use non-default decimal separators in numbers printed this way. See also

electron demo (electron.dem).

Gprintf

The string function gprintf("format",x) uses gnuplot's own format speci ers, as do the gnuplot commands set format, set timestamp, and others. These format speci ers are not the same as those used by the standard C-language routine sprintf(). gprintf() accepts only a single variable to be formatted. Gnuplot also provides an sprintf("format",x1,x2,...) routine if you prefer. For a list of gnuplot's format options, see format speci ers (p. 113).

gnuplot 4.6

113

Format speci ers

The acceptable formats (if not in time/date mode) are:

 

Tic-mark label numerical format speci ers

 

 

Format

Explanation

%f

oating point notation

%e or %E

exponential notation; an "e" or "E" before the power

%g or %G

the shorter of %e (or %E) and %f

%x or %X

hex

%o or %O

octal

%t

mantissa to base 10

%l

mantissa to base of current logscale

%s

mantissa to base of current logscale; scienti c power

%T

power to base 10

%L

power to base of current logscale

%S

scienti c power

%c

character replacement for scienti c power

%b

mantissa of ISO/IEC 80000 notation (ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi)

%B

pre x of ISO/IEC 80000 notation (ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi)

%P

multiple of pi

 

 

A 'scienti c' power is one such that the exponent is a multiple of three. Character replacement of scienti c powers ("%c") has been implemented for powers in the range -18 to +18. For numbers outside of this range the format reverts to exponential.

Other acceptable modi ers (which come after the "%" but before the format speci er) are "-", which leftjusti es the number; "+", which forces all numbers to be explicitly signed; " " (a space), which makes positive numbers have a space in front of them where negative numbers have "-"; "#", which places a decimal point after oats that have only zeroes following the decimal point; a positive integer, which de nes the eld width; "0" (the digit, not the letter) immediately preceding the eld width, which indicates that leading zeroes are to be used instead of leading blanks; and a decimal point followed by a non-negative integer, which de nes the precision (the minimum number of digits of an integer, or the number of digits following the decimal point of a oat).

Some systems may not support all of these modi ers but may also support others; in case of doubt, check the appropriate documentation and then experiment.

Examples:

 

set format y "%t"; set ytics (5,10)

# "5.0" and "1.0"

set format y "%s"; set ytics (500,1000)

# "500" and "1.0"

set format y "%+-12.3f"; set ytics(12345)

# "+12345.000 "

set format y "%.2t*10^%+03T"; set ytic(12345)# "1.23*10^+04"

set format y "%s*10^{%S}"; set ytic(12345)

# "12.345*10^{3}"

set format y "%s %cg"; set ytic(12345)

# "12.345 kg"

set format y "%.0P pi"; set ytic(6.283185)

# "2 pi"

set format y "%.0f%%"; set ytic(50)

# "50%"

set log y 2; set format y '%l'; set ytics (1,2,3) #displays "1.0", "1.0" and "1.5" (since 3 is 1.5 * 2^1)

There are some problem cases that arise when numbers like 9.999 are printed with a format that requires both rounding and a power.

If the data type for the axis is time/date, the format string must contain valid codes for the 'strftime' function (outside of gnuplot, type "man strftime"). See set timefmt (p. 154) for a list of the allowed input format codes.

Time/date speci ers

In time/date mode, the acceptable formats are:

Соседние файлы в папке Books