'Make a bar plot.
Make a bar plot with rectangles bounded by:
`left`, `left` + `width`, `bottom`, `bottom` + `height`
(left, right, bottom and top edges)
Parameters
left : sequence of scalars
the x coordinates of the left sides of the bars
height : scalar or sequence of scalars
the height(s) of the bars
width : scalar or array-like, optional
the width(s) of the bars
default: 0.8
bottom : scalar or array-like, optional
the y coordinate(s) of the bars
default: None
color : scalar or array-like, optional
the colors of the bar faces
edgecolor : scalar or array-like, optional
the colors of the bar edges
linewidth : scalar or array-like, optional
width of bar edge(s). If None, use default
linewidth; If 0, don\'t draw edges.
default: None
tick_label : string or array-like, optional
the tick labels of the bars
default: None
xerr : scalar or array-like, optional
if not None, will be used to generate errorbar(s) on the bar chart
default: None
yerr : scalar or array-like, optional
if not None, will be used to generate errorbar(s) on the bar chart
default: None
ecolor : scalar or array-like, optional
specifies the color of errorbar(s)
default: None
capsize : scalar, optional
determines the length in points of the error bar caps
default: None, which will take the value from the
``errorbar.capsize`` :data:`rcParam<matplotlib.rcParams>`.
error_kw : dict, optional
dictionary of kwargs to be passed to errorbar method. *ecolor* and
*capsize* may be specified here rather than as independent kwargs.
align : {\'center\', \'edge\'}, optional, default: \'center\'
If \'edge\', aligns bars by their left edges (for vertical bars) and
by their bottom edges (for horizontal bars). If \'center\', interpret
the `left` argument as the coordinates of the centers of the bars.
To align on the align bars on the right edge pass a negative
`width`.
orientation : {\'vertical\',  \'horizontal\'}, optional
The orientation of the bars.
log : boolean, optional
If true, sets the axis to be log scale.
default: False
Returns
bars : matplotlib.container.BarContainer
Container with all of the bars + errorbars
Notes
The optional arguments `color`, `edgecolor`, `linewidth`,
`xerr`, and `yerr` can be either scalars or sequences of
length equal to the number of bars.  This enables you to use
bar as the basis for stacked bar charts, or candlestick plots.
Detail: `xerr` and `yerr` are passed directly to
:meth:`errorbar`, so they can also have shape 2xN for
independent specification of lower and upper errors.
Other optional kwargs:
%(Rectangle)s
See also
barh: Plot a horizontal bar plot.'

@_preprocess_data(replace_names=[u'left', u'height', u'width', u'bottom', u'color', u'edgecolor', u'linewidth', u'tick_label', u'xerr', u'yerr', u'ecolor'], label_namer=None)
@docstring.dedent_interpd
def bar(self, left, height, width=0.8, bottom=None, **kwargs):

    kwargs = cbook.normalize_kwargs(kwargs, mpatches._patch_alias_map)
    if (not self._hold):
        self.cla()
    color = kwargs.pop(u'color', None)
    if (color is None):
        color = self._get_patches_for_fill.get_next_color()
    edgecolor = kwargs.pop(u'edgecolor', None)
    linewidth = kwargs.pop(u'linewidth', None)
    xerr = kwargs.pop(u'xerr', None)
    yerr = kwargs.pop(u'yerr', None)
    error_kw = kwargs.pop(u'error_kw', dict())
    ecolor = kwargs.pop(u'ecolor', u'k')
    capsize = kwargs.pop(u'capsize', rcParams[u'errorbar.capsize'])
    error_kw.setdefault(u'ecolor', ecolor)
    error_kw.setdefault(u'capsize', capsize)
    if rcParams[u'_internal.classic_mode']:
        align = kwargs.pop(u'align', u'edge')
    else:
        align = kwargs.pop(u'align', u'center')
    orientation = kwargs.pop(u'orientation', u'vertical')
    log = kwargs.pop(u'log', False)
    label = kwargs.pop(u'label', u'')
    tick_labels = kwargs.pop(u'tick_label', None)
    def make_iterable(x):
        if (not iterable(x)):
            return [x]
        else:
            return x
    _left = left
    left = make_iterable(left)
    height = make_iterable(height)
    width = make_iterable(width)
    _bottom = bottom
    bottom = make_iterable(bottom)
    linewidth = make_iterable(linewidth)
    adjust_ylim = False
    adjust_xlim = False
    if (orientation == u'vertical'):
        self._process_unit_info(xdata=left, ydata=height, kwargs=kwargs)
        if log:
            self.set_yscale(u'log', nonposy=u'clip')
        if (_bottom is None):
            if (self.get_yscale() == u'log'):
                adjust_ylim = True
            bottom = [0]
        nbars = len(left)
        if (len(bottom) == 1):
            bottom *= nbars
        tick_label_axis = self.xaxis
        tick_label_position = left
    elif (orientation == u'horizontal'):
        self._process_unit_info(xdata=width, ydata=bottom, kwargs=kwargs)
        if log:
            self.set_xscale(u'log', nonposx=u'clip')
        if (_left is None):
            if (self.get_xscale() == u'log'):
                adjust_xlim = True
            left = [0]
        nbars = len(bottom)
        if (len(left) == 1):
            left *= nbars
        tick_label_axis = self.yaxis
        tick_label_position = bottom
    else:
        raise ValueError((u'invalid    orientation:    %s' % orientation))
    if (len(height) == 1):
        height *= nbars
    if (len(width) == 1):
        width *= nbars
    if (len(linewidth) < nbars):
        linewidth *= nbars
    color = list(mcolors.to_rgba_array(color))
    if (len(color) == 0):
        color = [[0, 0, 0, 0]]
    if (len(color) < nbars):
        color *= nbars
    if (edgecolor is None):
        edgecolor = ([None] * nbars)
    else:
        edgecolor = list(mcolors.to_rgba_array(edgecolor))
        if (len(edgecolor) == 0):
            edgecolor = [[0, 0, 0, 0]]
        if (len(edgecolor) < nbars):
            edgecolor *= nbars
    if (len(left) != nbars):
        raise ValueError((u"incompatible    sizes:    argument    'left'    must    be    length    %d    or    scalar" % nbars))
    if (len(height) != nbars):
        raise ValueError((u"incompatible    sizes:    argument    'height'    must    be    length    %d    or    scalar" % nbars))
    if (len(width) != nbars):
        raise ValueError((u"incompatible    sizes:    argument    'width'    must    be    length    %d    or    scalar" % nbars))
    if (len(bottom) != nbars):
        raise ValueError((u"incompatible    sizes:    argument    'bottom'    must    be    length    %d    or    scalar" % nbars))
    patches = []
    if (self.xaxis is not None):
        left = self.convert_xunits(left)
        width = self.convert_xunits(width)
        if (xerr is not None):
            xerr = self.convert_xunits(xerr)
    if (self.yaxis is not None):
        bottom = self.convert_yunits(bottom)
        height = self.convert_yunits(height)
        if (yerr is not None):
            yerr = self.convert_yunits(yerr)
    if (align == u'center'):
        if (orientation == u'vertical'):
            left = [(l - (w / 2.0)) for (l, w) in zip(left, width)]
        elif (orientation == u'horizontal'):
            bottom = [(b - (h / 2.0)) for (b, h) in zip(bottom, height)]
    elif (align != u'edge'):
        raise ValueError((u'invalid    alignment:    %s' % align))
    args = zip(left, bottom, width, height, color, edgecolor, linewidth)
    for (l, b, w, h, c, e, lw) in args:
        r = mpatches.Rectangle(xy=(l, b), width=w, height=h, facecolor=c, edgecolor=e, linewidth=lw, label=u'_nolegend_')
        r.update(kwargs)
        r.get_path()._interpolation_steps = 100
        if (orientation == u'vertical'):
            r.sticky_edges.y.append(b)
        elif (orientation == u'horizontal'):
            r.sticky_edges.x.append(l)
        self.add_patch(r)
        patches.append(r)
    holdstate = self._hold
    self._hold = True
    if ((xerr is not None) or (yerr is not None)):
        if (orientation == u'vertical'):
            x = [(l + (0.5 * w)) for (l, w) in zip(left, width)]
            y = [(b + h) for (b, h) in zip(bottom, height)]
        elif (orientation == u'horizontal'):
            x = [(l + w) for (l, w) in zip(left, width)]
            y = [(b + (0.5 * h)) for (b, h) in zip(bottom, height)]
        if (u'label' not in error_kw):
            error_kw[u'label'] = u'_nolegend_'
        errorbar = self.errorbar(x, y, yerr=yerr, xerr=xerr, fmt=u'none', **error_kw)
    else:
        errorbar = None
    self._hold = holdstate
    if adjust_xlim:
        (xmin, xmax) = self.dataLim.intervalx
        xmin = min((w for w in width if (w > 0)))
        if (xerr is not None):
            xmin = (xmin - np.max(xerr))
        xmin = max((xmin * 0.9), 1e-100)
        self.dataLim.intervalx = (xmin, xmax)
    if adjust_ylim:
        (ymin, ymax) = self.dataLim.intervaly
        ymin = min((h for h in height if (h > 0)))
        if (yerr is not None):
            ymin = (ymin - np.max(yerr))
        ymin = max((ymin * 0.9), 1e-100)
        self.dataLim.intervaly = (ymin, ymax)
    self.autoscale_view()
    bar_container = BarContainer(patches, errorbar, label=label)
    self.add_container(bar_container)
    if (tick_labels is not None):
        tick_labels = make_iterable(tick_labels)
        if isinstance(tick_labels, six.string_types):
            tick_labels = [tick_labels]
        if (len(tick_labels) == 1):
            tick_labels *= nbars
        if (len(tick_labels) != nbars):
            raise ValueError((u"incompatible    sizes:    argument    'tick_label'    must    be    length    %d    or    string" % nbars))
        tick_label_axis.set_ticks(tick_label_position)
        tick_label_axis.set_ticklabels(tick_labels)
    return bar_container
