def plot_2d(self, X, labels=None, s=<NUM_LIT:20>, marker='<STR_LIT:o>',<EOL>dimensions=(<NUM_LIT:0>, <NUM_LIT:1>), ax=None, colors=None,<EOL>fignum=None, cmap=None, <EOL>** kwargs):
if cmap is None:<EOL><INDENT>cmap = matplotlib.cm.jet<EOL><DEDENT>if ax is None:<EOL><INDENT>fig = pylab.figure(fignum)<EOL>ax = fig.add_subplot(<NUM_LIT>)<EOL><DEDENT>if labels is None:<EOL><INDENT>labels = numpy.zeros(X.shape[<NUM_LIT:0>])<EOL><DEDENT>ulabels = []<EOL>for lab in labels:<EOL><INDENT>if not lab in ulabels:<EOL><INDENT>ulabels.append(lab)<EOL><DEDENT><DEDENT>nlabels = len(ulabels)<EOL>if colors is None:<EOL><INDENT>colors = iter([cmap(float(i) / nlabels) for i in range(nlabels)])<EOL><DEDENT>else:<EOL><INDENT>colors = iter(colors)<EOL><DEDENT>X_ = self.project(X, self.Q)[:,dimensions]<EOL>kwargs.update(dict(s=s))<EOL>plots = list()<EOL>for i, l in enumerate(ulabels):<EOL><INDENT>kwargs.update(dict(color=next(colors), marker=marker[i % len(marker)]))<EOL>plots.append(ax.scatter(*X_[labels == l, :].T, label=str(l), **kwargs))<EOL><DEDENT>ax.set_xlabel(r"<STR_LIT>")<EOL>ax.set_ylabel(r"<STR_LIT>")<EOL>try:<EOL><INDENT>pylab.tight_layout()<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>return plots<EOL>
Plot dimensions `dimensions` with given labels against each other in
PC space. Labels can be any sequence of labels of dimensions X.shape[0].
Labels can be drawn with a subsequent call to legend()