'Plot samples from the frequency distribution
displaying the most frequent sample first.  If an integer
parameter is supplied, stop after this many samples have been
plotted.  For a cumulative plot, specify cumulative=True.
(Requires Matplotlib to be installed.)
:param title: The title for the graph
:type title: str
:param cumulative: A flag to specify whether the plot is cumulative (default = False)
:type title: bool'

def plot(self, *args, **kwargs):

    try:
        from matplotlib import pylab
    except ImportError:
        raise ValueError(u'The    plot    function    requires    matplotlib    to    be    installed.See    http://matplotlib.org/')
    if (len(args) == 0):
        args = [len(self)]
    samples = [item for (item, _) in self.most_common(*args)]
    cumulative = _get_kwarg(kwargs, u'cumulative', False)
    if cumulative:
        freqs = list(self._cumulative_frequencies(samples))
        ylabel = u'Cumulative    Counts'
    else:
        freqs = [self[sample] for sample in samples]
        ylabel = u'Counts'
    pylab.grid(True, color=u'silver')
    if (not (u'linewidth' in kwargs)):
        kwargs[u'linewidth'] = 2
    if (u'title' in kwargs):
        pylab.title(kwargs[u'title'])
        del kwargs[u'title']
    pylab.plot(freqs, **kwargs)
    pylab.xticks(range(len(samples)), [text_type(s) for s in samples], rotation=90)
    pylab.xlabel(u'Samples')
    pylab.ylabel(ylabel)
    pylab.show()
