Credits Overview Plotting Styles Commands Terminals

minussign

Gnuplot uses the C language library routine sprintf() for most formatted input. However it also has its own formatting routine gprintf() that is used to generate axis tic labels. The C library routine always use a hyphen character (ascii \055) to indicate a negative number, as in -7. Many people prefer a different typographic minus sign character (unicode U+2212) for this purpose, as in −7. The command

     set minussign

causes gprintf() to use this minus sign character rather than a hyphen in numeric output. In a utf-8 locale this is the multibyte sequence corresponding to unicode U+2212. In a Window codepage 1252 locale this is the 8-bit character ALT+150 ("en dash"). The set minussign command will affect axis tic labels and any labels that are created by explicitly invoking gprintf. It has no effect on other strings that contain a hyphen. See gprintf.

Note that this command is ignored when you are using any of the LaTeX terminals, as LaTeX has its own mechanism for handling minus signs. It also is not necessary when using the postscript terminal because the postscript prologue output by gnuplot remaps the ascii hyphen code \055 to a different glyph named minus.

Example (assumes utf8 locale):

     set minus
     A = -5
     print "A = ",A                 # printed string will contain a hyphen
     print gprintf("A = %g",A)      # printed string will contain character U+2212
     set label "V = -5"             # label will contain a hyphen
     set label sprintf("V = %g",-5) # label will contain a hyphen
     set label gprintf("V = %g",-5) # label will contain character U+2212