Contents Previous Next Subchapters

Plotting A Bar Graph With Different Width Bars
Syntax gbar(y)
See Also bar , ghist , gstair

Plots a bar graph, where the integer, real, or double-precision column vector y specifies the height of the graph over each interval, and the column vector x specifies the interval limits and has one more row than y.

Width and Position of Bars
The vector x must be strictly monotone increasing and have one more element than the vector y. If m is the length of y, the value y(i) is plotted over the interval [x(i), x(i+1)] for i equal 1 to m. Thus the difference between the successive elements of x specifies the width of the bars. If x is not present, the value x(i) = i is used by default.

     gtitle("Bar Plot of x^2")
     y = seq(10)^2

returns the following plot: