def tile_raster_graphs(dct_reconstruct, orig, ae_reconstruct, tile_shape, tile_spacing=(0.1,0.1),
                        slice=(0,-1), axis=None, legend=True):

    assert orig.shape == ae_reconstruct.shape, 'orig ' + str(orig.shape) + ' and reconstruct ' + \
        str(ae_reconstruct.shape) + ' shapes are different'

    # make a little extra space between the subplots
    plt.subplots_adjust(wspace=tile_spacing[0], hspace=tile_spacing[1])

    num_examples = orig.shape[0]
    if num_examples > tile_shape[0] * tile_shape[1]:
        num_examples = tile_shape[0] * tile_shape[1]

    for i in xrange(0, num_examples):
        plt.subplot(tile_shape[0], tile_shape[1], i+1)
        plt.plot(orig[i][slice[0]:slice[1]], 'b-', label='orig')
        plt.plot(ae_reconstruct[i][slice[0]:slice[1]], 'g-', label='AE reconstruct')
        plt.plot(dct_reconstruct[i][slice[0]:slice[1]], 'r-', label='DCT reconstruct')
        if legend:
            plt.legend(loc='best')
        if axis is None:
            plt.axis('tight')
        else:
            plt.axis(axis)
    return plt
DESCRIPTION:
dataset/ETHPy150Open hycis/Pynet/pynet/utils/utils.py/tile_raster_graphs