def plotDataPoints(X, idx, K, ax):
    """ plots data points in X, coloring them so that those with the same
        index assignments in idx have the same color.
    """

    for i in range(K):

        # Color can be specified by a string matching the regex C[0-9].
        ax.plot(X[idx == i, 0], X[idx == i, 1], 'o', color='C' +
                str(i), markersize=8, fillstyle='none')

    return ax