Takes a grid of RGB or RGBA values and a filename to save the figure into.
    Generates a figure by coloring all grid cells appropriately.

def make_imshow_plot(grid, name):
    """
    Takes a grid of RGB or RGBA values and a filename to save the figure into.
    Generates a figure by coloring all grid cells appropriately.
    """
    plt.tick_params(labelbottom="off", labeltop="off", labelleft="off",
                    labelright="off", bottom="off", top="off", left="off",
                    right="off")
    plt.imshow(grid, interpolation="nearest", aspect=1, zorder=1)
    plt.tight_layout()
    plt.savefig(name, dpi=1000, bbox_inches="tight")