gnuplot documentation
gnuplot documentation
gnuplot documentation
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
33 IMAGE <strong>gnuplot</strong> 4.3 47<br />
This will produce a plot in which each vertical bar<br />
corresponds to one row of data. Each vertical bar<br />
contains a stack of two segments, corresponding in<br />
height to the values found in columns 2 and 4 of the<br />
datafile.<br />
10<br />
8<br />
6<br />
Rowstacked<br />
ClassB<br />
ClassA<br />
Finally, the commands<br />
set style histogram columnstacked<br />
plot ’file.dat’ using 2, ’’ using 4<br />
4<br />
2<br />
0<br />
will produce two vertical stacks, one for each column<br />
Columnstacked<br />
18<br />
of data. The stack at x=1 will contain a box for each 16<br />
entry in column 2 of the datafile. The stack at x=2 14<br />
will contain a box for each parallel entry in column 4 12<br />
of the datafile. Because this interchanges <strong>gnuplot</strong>’s 10<br />
usual interpretation of input rows and columns, the 8<br />
specification of key titles and x-axis tic labels must 6<br />
4<br />
also be modified.<br />
2<br />
set style histogram columnstacked<br />
0<br />
plot ’’ u 5:key(1)<br />
# uses first column to generate ClassA key ClassB titles<br />
plot ’’ u 5 title columnhead # uses first row to generate xtic labels<br />
32.1 Newhistogram<br />
More than one set of histograms can appear in a single plot. In this case you can force a gap between<br />
them, and a separate label for each set, by using the plot command newhistogram {""}<br />
{}. For example<br />
set style histogram cluster<br />
plot newhistogram "Set A", ’a’ using 1, ’’ using 2, ’’ using 3, \<br />
newhistogram "Set B", ’b’ using 1, ’’ using 2, ’’ using 3<br />
The labels "Set A" and "Set B" will appear beneath the respective sets of histograms, under the overall<br />
x axis label.<br />
The newhistogram command can also be used to force histogram coloring to begin with a specific color<br />
(linetype). By default colors will continue to increment successively even across histogram boundaries.<br />
Here is an example using the same coloring for multiple histograms<br />
plot newhistogram "Set A" lt 4, ’a’ using 1, ’’ using 2, ’’ using 3, \<br />
newhistogram "Set B" lt 4, ’b’ using 1, ’’ using 2, ’’ using 3<br />
32.2 Automated iteration over multiple columns<br />
If you want to create a histogram from many columns of data in a single file, it is very convenient to<br />
use the plot iteration feature. See iteration (p. 78). For example, to create stacked histograms of the<br />
data in columns 3 through 8<br />
set style histogram columnstacked<br />
plot for [i=3:8] "datafile" using i title columnhead<br />
33 Image<br />
The image style is intendend for projecting 2D images onto either 2D or 3D plots. It may be used for<br />
both plot and splot in the form of 3D data (x,y,value) or projected 4D data (x,y,z,value), respectively.<br />
It is assumed that in the viewing plane the image data forms an equidistant sampling grid in the viewing