Next: , Previous: set_style_increment, Up: style


3.24.61.6 set style line

Each terminal has a default set of line and point types, which can be seen by using the command test. `set style line` defines a set of line types and widths and point types and sizes so that you can refer to them later by an index instead of repeating all the information at each invocation.

Syntax:

           set style line <index> default
           set style line <index> {{linetype  | lt} <line_type> | <colorspec>}
                                  {{linecolor | lc} <colorspec>}
                                  {{linewidth | lw} <line_width>}
                                  {{pointtype | pt} <point_type>}
                                  {{pointsize | ps} <point_size>}
                                  {{pointinterval | pi} <interval>}
                                  {palette}
           unset style line
           show style line
     

If `default` is given all line style parameters are set to their default values.

If the linestyle <index> already exists, only the given parameters are changed while all others are preserved. If not, all undefined values are set to the default values.

The line and point types default to the index value. The exact symbol that is drawn for that index value may vary from one terminal type to another.

The line width and point size are multipliers for the current terminal's default width and size (but note that <point_size> here is unaffected by the multiplier given by the commandpointsize).

The `pointinterval` controls the spacing between points in a plot drawn with style linespoints. The default is 0 (every point is drawn). For example, `set style line N pi 3` defines a linestyle that uses pointtype N, pointsize and linewidth equal to the current defaults for the terminal, and will draw every 3rd point in plots using linespoints. A negative value for the interval is treated the same as a positive value, except that some terminals will try to interrupt the line where it passes through the point symbol.

Linestyles created by this mechanism do not replace the default linetype styles; both may be used. If you want plots to use the defined styles in preference to the default linetypes, please see `set style increment`.

Not all terminals support the `linewidth` and pointsize features; if not supported, the option will be ignored.

Terminal-independent colors may be assigned using either `linecolor <colorspec>` or `linetype <colorspec>`, abbreviated `lc` or `lt`. This requires giving a RGB color triple, a known palette color name, a fractional index into the current palette, or a constant value from the current mapping of the palette onto cbrange. See `colors`, colorspec, palette, colornames, cbrange.

`set style line <n> linetype <lt>` will set both a terminal-dependent dot/dash pattern and color. The commands`set style line <n> linecolor <colorspec>` or `set style line <n> linetype <colorspec>` will set a new line color while leaving the existing dot-dash pattern unchanged.

In 3d mode (`splot` command), the special keyword palette is allowed as a shorthand for "linetype palette z". The color value corresponds to the z-value (elevation) of the splot, and varies smoothly along a line or surface.

Examples: Suppose that the default lines for indices 1, 2, and 3 are red, green, and blue, respectively, and the default point shapes for the same indices are a square, a cross, and a triangle, respectively. Then

           set style line 1 lt 2 lw 2 pt 3 ps 0.5
     

defines a new linestyle that is green and twice the default width and a new pointstyle that is a half-sized triangle. The commands

           set style function lines
           plot f(x) lt 3, g(x) ls 1
     

will create a plot of f(x) using the default blue line and a plot of g(x) using the user-defined wide green line. Similarly the commands

           set style function linespoints
           plot p(x) lt 1 pt 3, q(x) ls 1
     

will create a plot of p(x) using the default triangles connected by a red line and q(x) using small triangles connected by a green line.

           splot sin(sqrt(x*x+y*y))/sqrt(x*x+y*y) w l pal
     

creates a surface plot using smooth colors according to palette. Note, that this works only on some terminals. See also palette, pm3d.

           set style line 10 linetype 1 linecolor rgb "cyan"
     

will assign linestyle 10 to be a solid cyan line on any terminal that supports rgb colors.