def _calc_density(
    x: np.ndarray,
    y: np.ndarray,
):
    """
    Function to calculate the density of cells in an embedding.
    """    

    # Calculate the point density
    xy = np.vstack([x,y])
    z = gaussian_kde(xy)(xy)

    min_z = np.min(z)
    max_z = np.max(z)

    # Scale between 0 and 1
    scaled_z = (z-min_z)/(max_z-min_z)

    return(scaled_z)
Function to calculate the density of cells in an embedding.