[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.17 linetypes, colors, and styles
Each gnuplot terminal type provides a set of distinct "linetypes". These may differ in color, in thickness, in dot/dash pattern, or in some combination of color and dot/dash. The default linetypes for a particular terminal can be previewed by issuing the test command after setting the terminal type. The pre-defined colors and dot/dash patterns are not guaranteed to be consistent for all terminal types, but all terminals use the special linetype -1 to mean a solid line in the primary foreground color (normally black). Most terminals also recognize the special linetype "bgnd" to mean a solid line in the background color.
You can redefine the default linetype properties either interactively or via an initialization file. This allows you to customize the colors and other properties of the lines used by all gnuplot plotting commands. See ‘set linetype‘.
By default, successive functions or datafiles plotted by a single command will be assigned successive linetypes. You can override this default sequence by specifying a particular linetype for any function, datafile, or plot element.
Examples:
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.
Examples:
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 colornames, palette, cbrange.
For terminals that support dot/dash patterns, each default linetype has both a dot-dash pattern and a default color. Gnuplot does not currently provide a mechanism for changing the dot-dash pattern, so if you want both a particular dash pattern and a particular color you must first choose a linetype that has the required dash pattern, then override the default color 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.
Example:
set term postscript dashed color plot 'foo' lt 3, 'baz' lt 3 linecolor 1, 'bar' lt 3 lc rgb 'gold'
1.17.1 colorspec | ||
1.17.2 linestyles vs linetypes |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 4, 2012 using texi2html 5.0.