def twoDimensionalHistogram(title, title_x, title_y,
                            z, bins_x, bins_y,
                            lim_x=None, lim_y=None,
                            vmin=None, vmax=None):
    """
    Create a two-dimension histogram plot or binned map.

    If using the outputs of np.histogram2d, remember to transpose the histogram.

    INPUTS
    """
    plt.figure()

    mesh_x, mesh_y = np.meshgrid(bins_x, bins_y)

    if vmin != None and vmin == vmax:
        plt.pcolor(mesh_x, mesh_y, z)
    else:
        plt.pcolor(mesh_x, mesh_y, z, vmin=vmin, vmax=vmax)
    plt.xlabel(title_x)
    plt.ylabel(title_y)
    plt.title(title)
    plt.colorbar()

    if lim_x:
        plt.xlim(lim_x[0], lim_x[1])
    if lim_y:
        plt.ylim(lim_y[0], lim_y[1])