def plot_phens_blits(phen_grid, patches, **kwargs):
    """
    A version of plot_phens designed to be used in animations. Takes a 2D array
    of phenotypes and a list of matplotlib patch objects that have already
    been added to the current axes and recolors the patches based on the array.
    """

    denom, palette = get_kwargs(phen_grid, kwargs)
    grid = color_grid(phen_grid, palette, denom)

    for i in range(len(grid)):
        for j in range(len(grid[i])):
            curr_patch = patches[i * len(grid[i]) + j]
            if grid[i][j] == -1:
                curr_patch.set_visible(False)
            else:
                curr_patch.set_facecolor(grid[i][j])
                curr_patch.set_visible(True)

    return patches
def plot_phens_blits ( phen_grid , patches , ** kwargs ) : denom , palette = get_kwargs ( phen_grid , kwargs ) grid = color_grid ( phen_grid , palette , denom ) for i in range ( len ( grid ) ) : for j in range ( len ( grid [ i ] ) ) : curr_patch = patches [ i * len ( grid [ i ] ) + j ] if grid [ i ] [ j ] == - 1 : curr_patch . set_visible ( False ) else : curr_patch . set_facecolor ( grid [ i ] [ j ] ) curr_patch . set_visible ( True ) return patches
A version of plot_phens designed to be used in animations. Takes a 2D array
    of phenotypes and a list of matplotlib patch objects that have already
    been added to the current axes and recolors the patches based on the array.