'Plots a barplot of returns by year.'

def _plot_yearly_returns(self, stats, ax=None, **kwargs):

    def format_perc(x, pos):
        return ('%.0f%%' % x)
    returns = stats['returns']
    if (ax is None):
        ax = plt.gca()
    y_axis_formatter = FuncFormatter(format_perc)
    ax.yaxis.set_major_formatter(FuncFormatter(y_axis_formatter))
    ax.yaxis.grid(linestyle=':')
    yly_ret = (perf.aggregate_returns(returns, 'yearly') * 100.0)
    yly_ret.plot(ax=ax, kind='bar')
    ax.set_title('Yearly    Returns    (%)', fontweight='bold')
    ax.set_ylabel('')
    ax.set_xlabel('')
    ax.set_xticklabels(ax.get_xticklabels(), rotation=45)
    ax.xaxis.grid(False)
    return ax
