gnuplot documentation
gnuplot documentation
gnuplot documentation
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
70 SET-SHOW <strong>gnuplot</strong> 4.3 101<br />
terminal, will work. Some other options have been added. If the format string looks like a floating point<br />
format, then <strong>gnuplot</strong> tries to construct a reasonable format.<br />
Characters not preceded by "%" are printed verbatim. Thus you can include spaces and labels in your<br />
format string, such as "%g m", which will put " m" after each number. If you want "%" itself, double<br />
it: "%g %%".<br />
See also set xtics (p. 143) for more information about tic labels, and set decimalsign (p. 97) for<br />
how to use non-default decimal separators in numbers printed this way. See also<br />
electron demo (electron.dem).<br />
70.21.1 Gprintf<br />
The string function gprintf("format",x) uses <strong>gnuplot</strong>’s own format specifiers, as do the <strong>gnuplot</strong> commands<br />
set format, set timestamp, and others. These format specifiers are not the same as those used by the<br />
standard C-language routine sprintf(). gprintf() accepts only a single variable to be formatted. Gnuplot<br />
also provides an sprintf("format",x1,x2,...) routine if you prefer. For a list of <strong>gnuplot</strong>’s format options,<br />
see format specifiers (p. 101).<br />
70.21.2 Format specifiers<br />
The acceptable formats (if not in time/date mode) are:<br />
Tic-mark label numerical format specifiers<br />
Format Explanation<br />
%f floating point notation<br />
%e or %E exponential notation; an ”e” or ”E” before the power<br />
%g or %G the shorter of %e (or %E) and %f<br />
%x or %X hex<br />
%o or %O octal<br />
%t mantissa to base 10<br />
%l mantissa to base of current logscale<br />
%s mantissa to base of current logscale; scientific power<br />
%T power to base 10<br />
%L power to base of current logscale<br />
%S scientific power<br />
%c character replacement for scientific power<br />
%P multiple of pi<br />
A ’scientific’ power is one such that the exponent is a multiple of three. Character replacement of<br />
scientific powers ("%c") has been implemented for powers in the range -18 to +18. For numbers outside<br />
of this range the format reverts to exponential.<br />
Other acceptable modifiers (which come after the "%" but before the format specifier) are "-", which<br />
left-justifies the number; "+", which forces all numbers to be explicitly signed; " " (a space), which<br />
makes positive numbers have a space in front of them where negative numbers have "-"; "#", which<br />
places a decimal point after floats that have only zeroes following the decimal point; a positive integer,<br />
which defines the field width; "0" (the digit, not the letter) immediately preceding the field width, which<br />
indicates that leading zeroes are to be used instead of leading blanks; and a decimal point followed by<br />
a non-negative integer, which defines the precision (the minimum number of digits of an integer, or the<br />
number of digits following the decimal point of a float).<br />
Some systems may not support all of these modifiers but may also support others; in case of doubt,<br />
check the appropriate <strong>documentation</strong> and then experiment.<br />
Examples:<br />
set format y "%t"; set ytics (5,10) # "5.0" and "1.0"<br />
set format y "%s"; set ytics (500,1000) # "500" and "1.0"