Credits | Overview | Plotting Styles | Commands | Terminals
--- | --- | --- | --- | ---

## linetype

The set linetype command allows you to redefine the basic linetypes used for plots. The command options are identical to those for "set style line". Unlike line styles, redefinitions by set linetype are persistent. They are not affected by reset. However the initial linetype properties are restored by reset session.

For example, whatever linetypes one and two look like to begin with, if you redefine them like this:

          set linetype 1 lw 2 lc rgb "blue" pointtype 6
          set linetype 2 lw 2 lc rgb "forest-green" pointtype 8

everywhere that uses lt 1 will now get a thick blue line. This includes uses such as the definition of a temporary linestyle derived from the base linetype 1. Similarly lt 2 will now produce a thick green line.

This mechanism can be used to define a set of personal preferences for the sequence of lines used in gnuplot. The recommended way to do this is to add to the run-time initialization file ~/.gnuplot a sequence of commands like

          set linetype 1 lc rgb "dark-violet" lw 2 pt 1
          set linetype 2 lc rgb "sea-green"   lw 2 pt 7
          set linetype 3 lc rgb "cyan"        lw 2 pt 6 pi -1
          set linetype 4 lc rgb "dark-red"    lw 2 pt 5 pi -1
          set linetype 5 lc rgb "blue"        lw 2 pt 8
          set linetype 6 lc rgb "dark-orange" lw 2 pt 3
          set linetype 7 lc rgb "black"       lw 2 pt 11
          set linetype 8 lc rgb "goldenrod"   lw 2
          set linetype cycle 8

Every time you run gnuplot the line types will be initialized to these values. You may initialize as many linetypes as you like. If you do not redefine, say, linetype 3 then it will continue to have the default properties (in this case blue, pt 3, lw 1, etc).

Similar script files can be used to define theme-based color choices, or sets of colors optimized for a particular plot type or output device.

The command set linetype cycle 8 tells gnuplot to re-use these definitions for the color and linewidth of higher-numbered linetypes. That is, linetypes 9-16, 17-24, and so on will use this same sequence of colors and widths. The point properties (pointtype, pointsize, pointinterval) are not affected by this command. unset linetype cycle disables this feature. If the line properties of a higher numbered linetype are explicitly defined, this takes precedence over the recycled low-number linetype properties.