next up previous contents index
Next: Postscript Up: Terminal Previous: Pm   Contents   Index


Png

Syntax:
     set terminal png 
            {{no}transparent} {{no}interlace}
            {{no}truecolor} {rounded|butt}
            {tiny | small | medium | large | giant}
            {font <face> {<pointsize>}}
            {size <x>,<y>} {{no}crop}
            {{no}enhanced}
            {<color0> <color1> <color2> ...}

PNG images are created using libgd, with optional support for TrueType and Adobe Type 1 fonts via libfreetype. Version 1.8 or greater of libgd is required.

transparent instructs the driver to generate transparent PNGs. The first color will be the transparent one. Default is notransparent.

interlace instructs the driver to generate interlaced PNGs. Default is nointerlace.

butt instructs the driver to use a line drawing method that does not overshoot the desired end point of a line. This setting is only applicable for line widths greater than 1. This setting is most useful when drawing horizontal or vertical lines. Default is rounded. Version 2.0 or greater of libgd is required.

PNG plots may be conveniently viewed by piping the output to the 'display' program from the ImageMagick package as follows:

              set term png
              set output '| display png:-'

View the output from successive plot commands interactively by hitting 5#5space6#6 in the display window. To save a particular one to disk, left click in the display window and choose save.

Five basic fonts are supported directly by the gd library. These are tiny (5x8 pixels), small (6x12 pixels), medium, (7x13 Bold), large (8x16) or giant (9x15 pixels). These fonts cannot be scaled or rotated (pure horizontal or vertical text only).

If gnuplot was built with support for TrueType (*.ttf) or Adobe Type 1 (*.pfa) fonts, they may be selected using the 'font 5#5face6#6 {5#5pointsize6#6}' option. 5#5face6#6 is either the full pathname to the font file, or a font face name that is assumed to be the first part of a filename in one of the directories listed in the GDFONTPATH environmental variable. That is, 'set term png font "Face"' will look for a font file named either 5#5somedirectory6#6/Face.ttf or 5#5somedirectory6#6/Face.pfa. Both TrueType and Adobe Type 1 fonts are fully scalable and may be rotated through any angle. If no font is specified, gnuplot checks the environmental variable GNUPLOT_DEFAULT_GDFONT to see if there is a preferred default font.

enhanced enables the enhanced text processing features, (subscripts, superscripts and mixed fonts). See enhanced (p. [*]) for more information. The full enhanced mode syntax is supported by the PNG/JPEG driver itself, but some of these features are dependent on which version of the underlying libgd library is present, and which fonts are available.

The size 5#5x,y6#6 is given in pixels -- it defaults to 640x480. The number of pixels can be also modified by scaling with the set size command. crop trims blank space from the edges of the completed plot, resulting in a smaller final image size. Default is nocrop.

Each color must be of the form 'xrrggbb', where x is the literal character 'x' and 'rrggbb' are the red, green and blue components in hex. For example, 'x00ff00' is green. The background color is set first, then the border colors, then the X & Y axis colors, then the plotting colors. The maximum number of colors that can be set is 256.

Examples:

     set terminal png medium size 640,480 \
                      xffffff x000000 x404040 \
                      xff0000 xffa500 x66cdaa xcdb5cd \
                      xadd8e6 x0000ff xdda0dd x9500d3    # defaults

which uses white for the non-transparent background, black for borders, gray for the axes, and red, orange, medium aquamarine, thistle 3, light blue, blue, plum and dark violet for eight plotting colors.


     set terminal png font arial 14 size 800,600

which searches for a TrueType font with face name 'arial' in the directory specified by the environment variable GDFONTPATH and 14pt font size.


     set terminal png transparent xffffff \
                      x000000 x202020 x404040 x606060 \
                      x808080 xA0A0A0 xC0C0C0 xE0E0E0

which uses white for the transparent background, black for borders, dark gray for axes, and a gray-scale for the six plotting colors.


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