<commit_before>"""Plotting."""

import pylab as pl

def show_images(Imgs, outfile=None):
    """Show a grid of images. Imgs is an array of columns of rows of images."""
    pl.rcParams['image.cmap'] = 'gray'
    pl.rcParams['image.aspect'] = 'equal'
    pl.rcParams['image.interpolation'] = 'none'
    ncols, nrows = max(len(imgs) for imgs in Imgs), len(Imgs)
    fig = pl.figure(figsize=(ncols*6, nrows*6))
    for i, imgs in enumerate(Imgs):
        for j, img in enumerate(imgs):
            ax = fig.add_subplot(nrows, ncols, i*ncols+j+1)
            ax.set_title('%i, %i' % (i, j))
            pl.imshow(img)
    pl.tight_layout()
    if outfile:
        pl.savefig(outfile, bbox_inches='tight')
    else:
        pl.imshow(img)
        pl.show()<commit_msg>show_images() can take x/y labels<commit_after>"""Plotting."""

import pylab as pl

def show_images(Imgs, ylabels=[], xlabels=[], outfile=None):
    """Show a grid of images. Imgs is an array of columns of rows of images."""
    pl.rcParams['image.cmap'] = 'gray'
    pl.rcParams['image.aspect'] = 'equal'
    pl.rcParams['image.interpolation'] = 'none'
    ncols, nrows = max(len(imgs) for imgs in Imgs), len(Imgs)
    fig = pl.figure(figsize=(ncols*6, nrows*6))
    for i, imgs in enumerate(Imgs):
        for j, img in enumerate(imgs):
            ax = fig.add_subplot(nrows, ncols, i*ncols+j+1)
            ax.set_title('%i, %i' % (i, j))
            if ylabels:
                ax.set_ylabel(ylabels[i])
            if xlabels:
                ax.set_xlabel(xlabels[j])
            pl.imshow(img)
    pl.tight_layout()
    if outfile:
        pl.savefig(outfile, bbox_inches='tight')
    else:
        pl.imshow(img)
        pl.show()
{'fraction_non_alphanumeric': 0.15334900117508812, 'fraction_numerical': 0.0035252643948296123, 'mean_word_length': 2.608050847457627, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '285110', 'n_tokens_mistral': 636, 'n_tokens_neox': 624, 'n_words': 145}