bar(___,width) sets
the relative bar width and controls the separation of bars within
a group and can include any of the input arguments in previous syntaxes.

bar(___,bar_color) displays
all bars using the color specified by the single-letter abbreviation
of bar_color and can include any of the input arguments
in previous syntaxes.

Set LineWidth and EdgeColor for the bars representing the second column in the data array y. Pass the handles returned by bar to the set function to set the barseries properties.

c = load('count.dat');
Y = c(1:6,:);
figure
hArray = bar(Y);
set(hArray(2),'LineWidth',2,'EdgeColor','red');

Bar lengths, specified as a vector or a 2-D array.

If Y is a vector, then bar creates length(Y) bars.
The bar function treats all vectors as column vectors.

If Y is a 2–D array, then bar groups
the bars produced by the elements in each row.

If Y is complex, then bar(Y) plots
the imaginary parts of Y versus the index of each
entry. If either x or Y is complex,
then bar(x,Y) ignores the imaginary parts and plots
the real parts of Y versus the real parts of x.

Bar width of each bar, specified as a fraction of the total
width of a bar and the space between bars. The default of 0.8 means
the a bar width is 80% of the space from the previous bar to the next
bar, with 10% of that space on each side.

If width is 1, the bars
within a group touch one another.

If Y is an m-by-n matrix,
then MATLAB^{®} displays m groups of n vertical
bars, where m is the number of rows and n is
the number of columns in Y.

If Y is a vector of length n,
then MATLAB treats Y as a column vector and
displays one group of n bars.

'stacked'

Displays one bar for each row in Y.

If Y is an m-by-n matrix,
then MATLAB displays m bars where each bar
height is the sum of the elements in the row. Each bar is multicolored.
Colors correspond to distinct elements and show the relative contribution
each row element makes to the total sum.

If Y is a vector of length n,
then MATLAB treats Y as a column vector and
displays n bars.

'histc'

Displays the graph in histogram format, in which bars
touch one another.

'hist'

Displays the graph in histogram format, but centers each
bar over the x-ticks, rather than making bars
span x-ticks as the histc option
does.

Axes handle specifying the target axes for the bar graph.

Example: bar(ah,Y);

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments.
Name is the argument
name and Value is the corresponding
value. Name must appear
inside single quotes (' ').
You can specify several name and value pair
arguments in any order as Name1,Value1,...,NameN,ValueN.

Arrangement of bars, specified as the comma-separated pair consisting
of 'BarLayout' and one of these values:

grouped — Display m groups
of n vertical bars, where m is
the number of rows and n is the number of columns
in the input argument Y. The group contains
one bar per column in Y.

stacked — Display one bar
for each row in the input argument Y. The
bar height is the sum of the elements in the row. Each bar is multicolored,
with colors corresponding to distinct elements and showing the relative
contribution each row element makes to the total sum.

Base line location, specified as the comma-separated pair consisting
of 'BaseValue' and the value along the y-axis
(vertical bars) or x-axis (horizontal bars) at
which MATLAB draws the baseline.

Relative bar width, specified as the comma-separated pair consisting
of 'BarWidth' and a value relative to width and
spacing. BarWidth controls the separation of bars
within a group. By default, the bars within a group have a slight
separation. A value of 1 makes bars touch with
no space. A value greater than 1 makes the bars
overlap.

Color of bar edges, specified as the comma-separated pair consisting
of 'EdgeColor' and a three-element RGB vector,
or one of the MATLAB predefined color specifier names.