plot "foo", "bar" # plot two files using linetypes 1, 2 plot sin(x) linetype 4 # terminal-specific linetype color 4 plot sin(x) lt -1 # black
For many terminal types it is also possible to assign user-defined colors using explicit rgb (red, green, blue) values, named colors, or color values that refer to the current PM3D palette.
plot sin(x) lt rgb "violet" # one of gnuplot's named colors plot sin(x) lt rgb "#FF00FF" # explicit RGB triple in hexadecimal plot sin(x) lt palette cb -45 # whatever color corresponds to -45 # in the current cbrange of the palette plot sin(x) lt palette frac 0.3 # fractional value along the palette
See show palette colornames (p. ), set palette (p. ), cbrange (p. ).
For terminals that support dot/dash patterns, each default linetype has both a dot-dash pattern and a default color. However, you can override the default color by using the keyword linecolor, abbreviated lc. For example, the postscript terminal provides a dashed blue line as linetype 3. The plot commands below use this same dash pattern for three plots, one in blue (the default), another in red (the default for linetype 1), and a third in gold.
set term postscript dashed color plot 'foo' lt 3, 'baz' lt 3 linecolor 1, 'bar' lt 3 lc rgb 'gold'
Lines can have additional properties such as linewidth. You can associate these various properties, as well as equivalent properties for point symbols, into user-defined "line styles" using the command set style line. Once you have defined a linestyle, you can use it in a plot command to control the appearance of one or more plot elements.
# define a new line style with terminal-independent color cyan, # linewidth 3, and associated point type 6 (a circle with a dot in it). set style line 5 lt rgb "cyan" lw 3 pt 6 plot sin(x) with linespoints ls 5 # user-defined line style 5
See linestyle (p. ), set style line (p. ).