bar3
Three-dimensional vertical bar plot.
bar3(x)
bar3(x,options)
bar3(x,y)
bar3(x,y, options)
Inputs
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 .


Description
If x is a one-dimensional array, bar3(x) displays vertical hexahdra in the y-z plane with rectangular faces (three-d bars) at the points [1,2,..n] along the y-axis, where n is the number of elements in x . The height of each bar is proportional to the magnitude of the corresponding elements of x .

If x has m columns, bar3(x) displays m rows vertical bars, one at each of the points [1,2,..n] where n is the number of rows in x , with each row located along the third dimension (x-axis). If one of the options is the string 'stacked' or 'grouped' , all the bars are placed in a single row, with the bars at each point [1,...n] stacked vertically one over the other or placed side by side with the heights of the bars determined by the elements in a given row of x .

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 bar3(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 bar3(x) .
Example
>>subplot(2,2,1)
>>bar3(rand(4,2))
>>title("Bar Plot")
>>subplot(2,2,2)
>>bar3(rand(4,3),'grouped')
>>title("Grouped Bar Plot")
>>subplot(2,2,3)
>>bar3(rand(4,3),'stacked')
>>title("Stacked Bar Plot")
>>subplot(2,2,4)
>>bar3(rand(4,2),'width',.3)
>>title("Bar Plot with Specified Fractional Width")