def _add_pattern_labels(ax, analysis, xtick_types, xfontsize):
    """Add pattern labels to the left of xticklabels. Use to distinguish different patterns."""
    xticktext = list(next(zip(*analysis.format_column_headers(xtick_types,
        firstcolumn=True))))
    xticktext = '\n'.join([''] + xticktext)
    fig = ax.figure
    fig.draw(fig.canvas.get_renderer())
    xticklabels = ax.get_xticklabels()[0]
    _, y = xticklabels.get_transform().transform(xticklabels.get_position())
    x, _ = ax.transAxes.transform((0, 0))
    x, y = fig.transFigure.inverted().transform([x, y])
    fig.text(x, y, xticktext, ha='right', va='top', fontsize=xfontsize)
