bar(y);
bar(x,y);
[xb,yb] = bar(...)
bar(y)
draws a bar graph of the elements of vector y
.
bar(x,y)
draws a bar graph of the elements in vector y
at the locations specified in vector x
. The values in x
must be evenly spaced and ascending.
If x
and y
are matrices of the same size, one bar graph per column is drawn.
[xb,yb] = bar(y)
and [xb,yb] = bar(x,y)
do not draw graphs, but return vectors xb
and yb
such that plot(xb,yb)
plots the bar chart. This is useful in situations where more control is needed over the appearance of a graph; for example, to incorporate a bar chart into a more elaborate plot
statement.
x = -2.9:0.2:2.9;
bar(x,exp(-x.
*x))
See Alsohist
,stairs
(c) Copyright 1994 by The MathWorks, Inc.