Two-dimensional vertical bar plot.
bar(x,y, options)
x An array of real numbers.
y An array of real numbers.
options A set of options to control the appearance of the plot. One of the options may be specified as the string 'stacked' or 'grouped' for stacking or grouping multiple bars. The other option may be used to specify the width of the plot in the form of a pair 'width', w , where w is the width parameter, a number between 0 and 1 .

If x is a one-dimensional array, bar(x) displays vertical rectangular bars at the points [1,2,..n] along the x-axis, where n is the number of elements in x . The height of each bar is proportional to the magnitude of the corresponding element of x .

If x has m columns, bar(x) displays m vertical rectangular bars at each of the points [1,2,..n] where n is the number of rows in x . If one of the options is the string 'stacked' , the bars at each point [1,...n] are stacked vertically one over the other with the heights of the stacks determined by the elements in a given row of x . Otherwise the bars at a given point are grouped side by side.

The distance between the bars at adjoining points on the x-axis can be controlled by specifying the width parameter in the input options . If width is specified to be one, there is no gap between the bars at various points, and if it is zero, bars are displayed with maximum possible gaps between them. Intermediate values of the width parameter control the width of gaps accordingly.

In the call bar(x, y) , the height of the bars is specified by the elements of y , and elements of x are used for the locations of the bars along the x-axis. The inputs specified in options control the gap size and the type of grouping of bars just as for the call bar(x) .

>>title("Bar Plot")
>>xtics([1 2 3 4],{"One","Two","Three","Four"});
>>title("Grouped Bar Plot")
>>xtics([1 2 3 4],{"One","Two","Three","Four"});
>>title("Stacked Bar Plot")
>>xtics([1 2 3 4],{"One","Two","Three","Four"});
>>title("Bar Plot with Specified Fractional Width")
>>xtics([1 2 3 4],{"One","Two","Three","Four"});