[py3] iterator .next fixes

This commit is contained in:
Max Zwiessele 2016-06-22 09:01:28 +01:00
parent f3359b7ad4
commit 83ae7cb577
2 changed files with 3 additions and 3 deletions

View file

@ -34,7 +34,7 @@ def plot(parameterized, fignum=None, ax=None, colors=None, figsize=(12, 6)):
else: else:
raise ValueError("Need one ax per latent dimension input_dim") raise ValueError("Need one ax per latent dimension input_dim")
bg_lines.append(a.plot(means, c='k', alpha=.3)) bg_lines.append(a.plot(means, c='k', alpha=.3))
lines.extend(a.plot(x, means.T[i], c=colors.next(), label=r"$\mathbf{{X_{{{}}}}}$".format(i))) lines.extend(a.plot(x, means.T[i], c=next(colors), label=r"$\mathbf{{X_{{{}}}}}$".format(i)))
fills.append(a.fill_between(x, fills.append(a.fill_between(x,
means.T[i] - 2 * np.sqrt(variances.T[i]), means.T[i] - 2 * np.sqrt(variances.T[i]),
means.T[i] + 2 * np.sqrt(variances.T[i]), means.T[i] + 2 * np.sqrt(variances.T[i]),
@ -86,7 +86,7 @@ def plot_SpikeSlab(parameterized, fignum=None, ax=None, colors=None, side_by_sid
# mean and variance plot # mean and variance plot
a = fig.add_subplot(*sub1) a = fig.add_subplot(*sub1)
a.plot(means, c='k', alpha=.3) a.plot(means, c='k', alpha=.3)
plots.extend(a.plot(x, means.T[i], c=colors.next(), label=r"$\mathbf{{X_{{{}}}}}$".format(i))) plots.extend(a.plot(x, means.T[i], c=next(colors), label=r"$\mathbf{{X_{{{}}}}}$".format(i)))
a.fill_between(x, a.fill_between(x,
means.T[i] - 2 * np.sqrt(variances.T[i]), means.T[i] - 2 * np.sqrt(variances.T[i]),
means.T[i] + 2 * np.sqrt(variances.T[i]), means.T[i] + 2 * np.sqrt(variances.T[i]),

View file

@ -131,7 +131,7 @@ class PCA(object):
kwargs.update(dict(s=s)) kwargs.update(dict(s=s))
plots = list() plots = list()
for i, l in enumerate(ulabels): for i, l in enumerate(ulabels):
kwargs.update(dict(color=colors.next(), marker=marker[i % len(marker)])) kwargs.update(dict(color=next(colors), marker=marker[i % len(marker)]))
plots.append(ax.scatter(*X_[labels == l, :].T, label=str(l), **kwargs)) plots.append(ax.scatter(*X_[labels == l, :].T, label=str(l), **kwargs))
ax.set_xlabel(r"PC$_1$") ax.set_xlabel(r"PC$_1$")
ax.set_ylabel(r"PC$_2$") ax.set_ylabel(r"PC$_2$")