'Create a stem plot.
Call signatures::
stem(y, linefmt=\'b-\', markerfmt=\'bo\', basefmt=\'r-\')
stem(x, y, linefmt=\'b-\', markerfmt=\'bo\', basefmt=\'r-\')
A stem plot plots vertical lines (using *linefmt*) at each *x*
location from the baseline to *y*, and places a marker there
using *markerfmt*.  A horizontal line at 0 is plotted using
*basefmt*.
If no *x* values are provided, the default is (0, 1, ..., len(y) - 1)
Return value is a tuple (*markerline*, *stemlines*,
*baseline*). See :class:`~matplotlib.container.StemContainer`
.. seealso::
This
`document <http://www.mathworks.com/help/techdoc/ref/stem.html>`_
for details.'

@_preprocess_data(replace_all_args=True, label_namer=None)
def stem(self, *args, **kwargs):

    remember_hold = self._hold
    if (not self._hold):
        self.cla()
    self._hold = True
    y = np.asarray(args[0])
    args = args[1:]
    try:
        second = np.asarray(args[0], dtype=float)
        (x, y) = (y, second)
        args = args[1:]
    except (IndexError, ValueError):
        second = np.arange(len(y))
        x = second
    try:
        linefmt = kwargs[u'linefmt']
    except KeyError:
        try:
            linefmt = args[0]
        except IndexError:
            linecolor = u'C0'
            linemarker = u'None'
            linestyle = u'-'
        else:
            (linestyle, linemarker, linecolor) = _process_plot_format(linefmt)
    else:
        (linestyle, linemarker, linecolor) = _process_plot_format(linefmt)
    try:
        markerfmt = kwargs[u'markerfmt']
    except KeyError:
        try:
            markerfmt = args[1]
        except IndexError:
            markercolor = u'C0'
            markermarker = u'o'
            markerstyle = u'None'
        else:
            (markerstyle, markermarker, markercolor) = _process_plot_format(markerfmt)
    else:
        (markerstyle, markermarker, markercolor) = _process_plot_format(markerfmt)
    try:
        basefmt = kwargs[u'basefmt']
    except KeyError:
        try:
            basefmt = args[2]
        except IndexError:
            if rcParams[u'_internal.classic_mode']:
                basecolor = u'C2'
            else:
                basecolor = u'C3'
            basemarker = u'None'
            basestyle = u'-'
        else:
            (basestyle, basemarker, basecolor) = _process_plot_format(basefmt)
    else:
        (basestyle, basemarker, basecolor) = _process_plot_format(basefmt)
    bottom = kwargs.pop(u'bottom', None)
    label = kwargs.pop(u'label', None)
    (markerline,) = self.plot(x, y, color=markercolor, linestyle=markerstyle, marker=markermarker, label=u'_nolegend_')
    if (bottom is None):
        bottom = 0
    stemlines = []
    for (thisx, thisy) in zip(x, y):
        (l,) = self.plot([thisx, thisx], [bottom, thisy], color=linecolor, linestyle=linestyle, marker=linemarker, label=u'_nolegend_')
        stemlines.append(l)
    (baseline,) = self.plot([np.min(x), np.max(x)], [bottom, bottom], color=basecolor, linestyle=basestyle, marker=basemarker, label=u'_nolegend_')
    self._hold = remember_hold
    stem_container = StemContainer((markerline, stemlines, baseline), label=label)
    self.add_container(stem_container)
    return stem_container
