Credits Overview Plotting Styles Commands Terminals

linetypes, colors, and styles

In older gnuplot versions, each terminal type provided a set of distinct "linetypes" that could differ in color, in thickness, in dot/dash pattern, or in some combination of color and dot/dash. These colors and patterns were not guaranteed to be consistent across different terminal types although most used the color sequence red/green/blue/magenta/cyan/yellow. You can select this old behaviour via the command set colorsequence classic, but by default gnuplot version 5 uses a terminal-independent sequence of 8 colors.

You can further customize the sequence of linetype properties interactively or in an initialization file. See set linetype. Several sample initialization files are provided in the distribution package.

The current linetype properties for a particular terminal can be previewed by issuing the test command after setting the terminal type.

Successive functions or datafiles plotted by a single command will be assigned successive linetypes in the current default sequence. You can override this for any individual function, datafile, or plot element by giving explicit line properties in the plot command.

Examples:

     plot "foo", "bar"                 # plot two files using linetypes 1, 2
     plot sin(x) linetype 4            # use linetype color 4

In general, colors can be specified using named colors, rgb (red, green, blue) components, hsv (hue, saturation, value) components, or a coordinate along the current pm3d palette. The keyword linecolor may be abbreviated to lc.

Examples:

     plot sin(x) lc rgb "violet"       # use one of gnuplot's named colors
     plot sin(x) lc rgb "#FF00FF"      # explicit RGB triple in hexadecimal
     plot sin(x) lc palette cb -45     # whatever color corresponds to -45
                                       # in the current cbrange of the palette
     plot sin(x) lc palette frac 0.3   # fractional value along the palette

See colorspec, show colornames, hsv, set palette, cbrange. See also set monochrome.

Linetypes also have an associated dot-dash pattern although not all terminal types are capable of using it. Gnuplot version 5 allows you to specify the dot-dash pattern independent of the line color. See dashtype.

Subtopics