mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-04 01:02:39 +02:00
[pca] colors now as iterator
This commit is contained in:
parent
dfa23b77c5
commit
8c8d06c8ae
1 changed files with 4 additions and 2 deletions
|
|
@ -106,12 +106,14 @@ class pca(object):
|
||||||
ulabels.append(lab)
|
ulabels.append(lab)
|
||||||
nlabels = len(ulabels)
|
nlabels = len(ulabels)
|
||||||
if colors is None:
|
if colors is None:
|
||||||
colors = [cmap(float(i) / nlabels) for i in range(nlabels)]
|
colors = iter([cmap(float(i) / nlabels) for i in range(nlabels)])
|
||||||
|
else:
|
||||||
|
colors = iter(colors)
|
||||||
X_ = self.project(X, self.Q)[:,dimensions]
|
X_ = self.project(X, self.Q)[:,dimensions]
|
||||||
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[i], marker=marker[i % len(marker)]))
|
kwargs.update(dict(color=colors.next(), 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$")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue