Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pmi432 / LR02 / Books / gnuplot 4.6 manual.pdf
Скачиваний:
59
Добавлен:
18.03.2015
Размер:
2.22 Mб
Скачать

gnuplot 4.6

35

Linecolor variable

lc variable tells the program to use the value read from one column of the input data as a linetype index, and use the color belonging to that linetype. This requires a corresponding additional column in the using speci er. Text colors can be set similarly using tc variable.

Examples:

#Use the third column of data to assign colors to individual points plot 'data' using 1:2:3 with points lc variable

#A single data file may contain multiple sets of data, separated by two

#blank lines. Each data set is assigned as index value (see `index`)

#that can be retrieved via the `using` specifier `column(-2)`.

#See `pseudocolumns`. This example uses to value in column -2 to

#draw each data set in a different line color.

plot 'data' using 1:2:(column(-2)) with lines lc variable

Rgbcolor variable

You can assign a separate color for each data point, line segment, or label in your plot. lc rgbcolor variable tells the program to read RGB color information for each line in the data le. This requires a corresponding additional column in the using speci er. The extra column is interpreted as a 24-bit packed RGB triple. If the value is provided directly in the data le it is easiest to give it as a hexidecimal value (see rgbcolor (p. 34)). Alternatively, the using speci er can contain an expression that evaluates to a 24-bit RGB color as in the example below. Text colors are similarly set using tc rgbcolor variable.

Example:

#Place colored points in 3D at the x,y,z coordinates corresponding to

#their red, green, and blue components

rgb(r,g,b) = 65536 * int(r) + 256 * int(g) + int(b)

splot "data" using 1:2:3:(rgb($1,$2,$3)) with points lc rgb variable

Linestyles vs linetypes

Lines can have additional properties such as linewidth. You can associate these various properties, as well as equivalent properties for point symbols, into user-de ned "linestyles" using the command set style line. Once you have de ned a linestyle, you can use it in a plot command to control the appearance of one or more plot elements.

Whereas linetypes are permanent (they last until you explicitly rede ne them), linestyles are temporary. They only last until the next reset of the graphics state.

Examples:

#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

Mouse input

Many terminals allow interaction with the current plot using the mouse. Some also support the de nition of hotkeys to activate pre-de ned functions by hitting a single key while the mouse focus is in the active plot window. It is even possible to combine mouse input with batch command scripts, by invoking the command pause mouse and then using the mouse variables returned by mouse clicking as parameters for subsequent scripted actions. See bind (p. 36) and mouse variables (p. 37). See also the command set mouse (p. 126).

Соседние файлы в папке Books