def plot_ks_dist(ax, data, interval, components, ks_max,
                 color='r', marker='.', fill=False, fitted=True):

    line, = my_hist(ax, data, interval, ks_max,
                    color=color, marker=marker, fill=fill)
    logging.debug("Total {0} pairs after filtering.".format(len(data)))

    line_mixture = None
    if fitted:
        probs, mus, variances = get_mixture(data, components)

        iv = .001
        bins = np.arange(iv, ks_max, iv)
        y = lognormpdf_mix(bins, probs, mus, variances, interval)

        line_mixture, = ax.plot(bins, y, ':', color=color, lw=3)

        for i in xrange(components):
            peak_val = exp(mus[i])
            mixline = lognormpdf_mix(peak_val, probs, mus, variances, interval)
            ax.text(peak_val, mixline, peak_val % "Ks=%.2f", \
                    color="w", size=10, bbox=dict(ec='w',fc=color, \
                    alpha=.6, boxstyle='round'))

    return line, line_mixture
dataset/ETHPy150Open tanghaibao/jcvi/apps/ks.py/plot_ks_dist/swapped operands of `%`