<< axis | Graphics functions | bone >> |
bar(Y) |
bar(X, Y) |
bar(..., width) |
bar(..., color) |
bar(..., propertyName, propertyValue) |
bar(ax, ...) |
b = bar(...) |
x-coordinates: scalar, vector or string array.
y-coordinates: vector.
scalar, 0.8 (default).
a scalar string or row vector character: short name color.
a scalar string or row vector character.
a value.
Axes object.
patch graphics object.
bar(X, Y) creates a bar graph using two sets of X-Y data vectors.
When only one argument is provided (Y), it is interpreted as a vector containing Y values, and the X coordinates are generated as a sequence from 1 to the number of elements in the Y vector.
You can optionally specify the width of the bars.
A value of 1.0 will make each bar exactly touch its neighboring bars, while the default width is set to 0.8.
f = figure();
y = [ 91 75 123.5 105 150 131 203 179 249 226 281.5];
bar(y);
f = figure();
y = [ 91 75 123.5 105 150 131 203 179 249 226 281.5];
bar(y, 0.5);
f = figure();
x = 1900:10:2000;
y = [75 91 105 123.5 131 150 179 203 226 249 281.5];
bar(x, y, 'r');
f = figure();
x = [ "Summer", "Spring", "Winter", "Autumn"];
y = [ 2 1 4 3];
bar(x, y);
f = figure();
y = [91 75 123.5 105 150 131 203 179 249 226 281.5];
bar(y, 'FaceColor', [0 .5 .5], 'EdgeColor', [0 .9 .9], 'LineWidth', 1.5)
Version | Description |
---|---|
1.0.0 | initial version |
Allan CORNET