Boxes
In 2D plots the boxes style draws a rectangle centered about the given x coordinate that extends from the x axis, i.e. from y=0 not from the graph border, to the given y coordinate. The width of the box can be provided in an additional input column or controlled by set boxwidth. Otherwise each box extends to touch the adjacent boxes.In 3D plots the boxes style draws a box centered at the given [x,y] coordinate that extends from the plane at z=0 to the given z coordinate. The width of the box on x can be provided in a separate input column or via set boxwidth. The depth of the box on y is controlled by set boxdepth. Boxes do not automatically expand to touch each other as in 2D plots.
2D boxes
plot with boxes uses 2 or 3 columns of basic data. Additional input columns may be used to provide information such as variable line or fill color. See rgbcolor variable.
2 columns: x y 3 columns: x y x_width
The width of the box is obtained in one of three ways. If the input data has a third column, this will be used to set the box width. Otherwise if a width has been set using the set boxwidth command, this will be used. If neither of these is available, the width of each box will be calculated so that it touches the adjacent boxes.
The box interiors are drawn using the current fillstyle. Alternatively a fillstyle may be specified in the plot command. See set style fill. If no fillcolor is given in the plot command, the current line color is used.
Examples:
To plot a data file with solid filled boxes with a small vertical space separating them (bargraph):
set boxwidth 0.9 relative set style fill solid 1.0 plot 'file.dat' with boxes
To plot a sine and a cosine curve in pattern-filled boxes style:
set style fill pattern plot sin(x) with boxes, cos(x) with boxes
The sin plot will use pattern 0; the cos plot will use pattern 1. Any additional plots would cycle through the patterns supported by the terminal driver.
To specify explicit fillstyles and fillcolors for each dataset:
plot 'file1' with boxes fs solid 0.25 fc 'cyan', \ 'file2' with boxes fs solid 0.50 fc 'blue', \ 'file3' with boxes fs solid 0.75 fc 'magenta', \ 'file4' with boxes fill pattern 1, \ 'file5' with boxes fill empty
3D boxes
splot with boxes requires at least 3 columns of input data. Additional input columns may be used to provide information such as box width or fill color.
3 columns: x y z 4 columns: x y z [x_width or color] 5 columns: x y z x_width color
The last column is used as a color only if the splot command specifies a variable color mode. Examples
splot 'blue_boxes.dat' using 1:2:3 fc "blue" splot 'rgb_boxes.dat' using 1:2:3:4 fc rgb variable splot 'category_boxes.dat' using 1:2:3:4:5 lc variable
In the first example all boxes are blue and have the width previously set by set boxwidth. In the second example the box width is still taken from set boxwidth because the 4th column is interpreted as a 24-bit RGB color. The third example command reads box width from column 4 and interprets the value in column 5 as an integer linetype from which the color is derived.
By default boxes have no thickness; they consist of a single rectangle parallel to the xz plane at the specified y coordinate. You can change this to a true box with four sides and a top by setting a non-zero extent on y. See set boxdepth.
3D boxes are processed as pm3d quadrangles rather than as surfaces. Because of this the front/back order of drawing is not affected by set hidden3d. Similarly if you want each box face to have a border you must use set pm3d border rather than set style fill border. See set pm3d. For best results use a combination of set pm3d depthorder base and set pm3d lighting.
Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
Distributed under the gnuplot license (rights to distribute modified versions are withheld).