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

gnuplot 4.6

53

Automated iteration over multiple columns

If you want to create a histogram from many columns of data in a single le, it is very convenient to use the plot iteration feature. See iteration (p. 70). For example, to create stacked histograms of the data in columns 3 through 8

set style histogram columnstacked

plot for [i=3:8] "datafile" using i title columnhead

Image

The image, rgbimage, and rgbalpha plotting styles all project a uniformly sampled grid of data values onto a plane in either 2D or 3D. The input data may be an actual bitmapped image, perhaps converted from a standard format such as PNG, or a simple array of numerical values.

This gure illustrates generation of a heat map from an array of scalar values. The current palette is used to map each value onto the color assigned to the corresponding pixel.

plot '-' matrix with image 5 4 3 1 0 2 2 0 0 1 0 0 0 1 0 0 1 2 4 3

e e

 

2D Heat map from in-line array of values

 

0

1

2

3

4

0

1

2

3

Each pixel (data point) of the input 2D image will be-

 

 

 

 

 

RGB image mapped onto a plane in 3D

come a rectangle or parallelipiped in the plot. The co-

 

 

 

 

 

1.0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ordinates of each data point will determine the center

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

of the parallelipiped. That is, an M x N set of data

0.5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

will form an image with M x N pixels. This is di er-

0.0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ent from the pm3d plotting style, where an M x N set

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

of data will form a surface of (M-1) x (N-1) elements.

-0.5

 

 

 

 

 

 

 

 

 

 

120

The scan directions for a binary image data grid can be

 

 

 

 

 

 

 

 

 

 

 

 

 

100

 

-1.0

 

 

 

 

 

 

 

 

 

 

80

 

 

 

further controlled by additional keywords. See binary

 

 

 

 

 

 

 

 

 

 

60

 

 

 

 

 

 

 

 

 

 

 

 

 

0

20

40

 

 

 

 

 

 

40

 

 

 

keywords ipx (p. 76), keywords center (p. 76),

 

 

 

 

 

 

60

 

 

 

 

20

 

 

 

 

 

 

 

 

 

 

80

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

100

120

0

 

 

 

and keywords rotate (p. 76).

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Image data can be scaled to ll a particular rectangle

 

 

 

 

 

Rescaled image used as plot element

within a 2D plot coordinate system by specifying the x

 

 

 

 

 

200

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

200

and y extent of each pixel. See binary keywords dx

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Building Heights

 

 

(p. 76) and dy (p. 76). To generate the gure at the

150

 

 

 

 

 

 

 

 

 

 

 

 

by Neighborhood

 

150

 

 

 

 

 

 

 

 

 

 

 

 

 

 

right, the same input image was placed multiple times,

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

each with a speci ed dx, dy, and origin. The input PNG

100

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

100

 

 

 

 

 

 

 

 

 

 

 

 

 

image of a building is 50x128 pixels. The tall building

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

was drawn by mapping this using dx=0.5 dy=1.5. The

50

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

50

 

 

 

 

 

 

 

 

 

 

 

 

 

short building used a mapping dx=0.5 dy=0.35.

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

The image style handles input pixels containing a

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Downtown

 

S

 

 

NE

 

 

Suburbs

grayscale or color palette value. Thus 2D plots (plot command) require 3 columns of data (x,y,value), while 3D plots (splot command) require 4 columns of data (x,y,z,value).

The rgbimage style handles input pixels that are described by three separate values for the red, green, and blue components. Thus 5D data (x,y,r,g,b) is needed for plot and 6D data (x,y,z,r,g,b) for splot. The individual red, green, and blue components are assumed to lie in the range [0:255].

The rgbalpha style handles input pixels that contain alpha channel (transparency) information in addition to the red, green, and blue components. Thus 6D data (x,y,r,g,b,a) is needed for plot and 7D data (x,y,z,r,g,b,a) for splot. The r, g, b, and alpha components are assumed to lie in the range [0:255].

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