from matplotlib.patches import PathPatch

def contour_to_hatched_patches(cntrset, hatch_colors, hatch_patterns,
                               remove_contour=True):
    from itertools import cycle

    patches_list = []
    for pathcollection in cntrset.collections:
        patches_list.append([PathPatch(p1) for p1 in  pathcollection.get_paths()])
        if remove_contour:
            pathcollection.remove()

    for patches, hc, hp  in zip(patches_list,
                                cycle(hatch_colors), cycle(hatch_patterns)):
        for p in patches:
            p.set_fc("none")
            p.set_ec("k")
            p.set_hatch(hp)
            ax.add_patch(p)


if __name__ == "__main__":

    import numpy as np
    import matplotlib.pyplot as plt

    y, x = np.indices((10,10))
    dx, dy = x - 4.5, y-4.5
    dr2 = dx*dx+dy*dy
    arr = np.exp(-dr2/16.)


    ax = plt.subplot(111)

    cntrset = ax.contourf(arr)

    hatch_colors = "k"
    hatch_patterns = "/\|-+xoO.*"

    contour_to_hatched_patches(cntrset, hatch_colors, hatch_patterns,
                               remove_contour=False)

    plt.show()
