def plot_LDA(X_lda, y_lda, class_colors, exp_var, style, fig_size, label_pad,<EOL>font_size, sids, dim=<NUM_LIT:2>, zangles=None, pt_size=<NUM_LIT>, out_fp="<STR_LIT>"):
cats = class_colors.keys()<EOL>fig = plt.figure(figsize=fig_size)<EOL>if dim == <NUM_LIT:3>:<EOL><INDENT>try:<EOL><INDENT>assert X_lda.shape[<NUM_LIT:1>] >= <NUM_LIT:3><EOL><DEDENT>except AssertionError:<EOL><INDENT>sys.exit("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>if sids is not None:<EOL><INDENT>print("<STR_LIT>")<EOL><DEDENT>ax = fig.add_subplot(<NUM_LIT>, projection="<STR_LIT>")<EOL>ax.view_init(elev=zangles[<NUM_LIT:1>], azim=zangles[<NUM_LIT:0>])<EOL>try:<EOL><INDENT>ax.set_zlabel("<STR_LIT>".<EOL>format(exp_var[<NUM_LIT:2>]*<NUM_LIT:100>), fontsize=font_size, labelpad=label_pad)<EOL><DEDENT>except:<EOL><INDENT>ax.set_zlabel("<STR_LIT>", fontsize=font_size, labelpad=label_pad)<EOL><DEDENT>for i, target_name in zip(range(len(cats)), cats):<EOL><INDENT>cat_x = X_lda[:, <NUM_LIT:0>][y_lda == target_name]<EOL>cat_y = X_lda[:, <NUM_LIT:1>][y_lda == target_name]<EOL>cat_z = X_lda[:, <NUM_LIT:2>][y_lda == target_name]<EOL>ax.scatter(xs=cat_x, ys=cat_y, zs=cat_z, label=target_name,<EOL>c=class_colors[target_name], alpha=<NUM_LIT>, s=pt_size, edgecolors="<STR_LIT:k>",<EOL>zdir="<STR_LIT:z>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>ax = fig.add_subplot(<NUM_LIT>)<EOL>for i, target_name in zip(range(len(cats)), cats):<EOL><INDENT>cat_x = X_lda[:, <NUM_LIT:0>][y_lda == target_name]<EOL>if X_lda.shape[<NUM_LIT:1>] == <NUM_LIT:1>:<EOL><INDENT>cat_y = np.ones((cat_x.shape[<NUM_LIT:0>], <NUM_LIT:1>)) + i<EOL><DEDENT>else:<EOL><INDENT>cat_y = X_lda[:, <NUM_LIT:1>][y_lda == target_name]<EOL><DEDENT>ax.scatter(x=cat_x, y=cat_y, label=target_name, alpha=<NUM_LIT>, s=pt_size,<EOL>color=class_colors[target_name], edgecolors="<STR_LIT:k>")<EOL><DEDENT>if sids is not None:<EOL><INDENT>for sample, point, group in zip(sids, X_lda, y_lda):<EOL><INDENT>try:<EOL><INDENT>assert len(point) >= <NUM_LIT:2><EOL><DEDENT>except AssertionError:<EOL><INDENT>point = (point[<NUM_LIT:0>], cats.index(group)+<NUM_LIT:1>)<EOL><DEDENT>finally:<EOL><INDENT>ax.annotate(s=sample, xy=point[:<NUM_LIT:2>], xytext=(<NUM_LIT:0>, -<NUM_LIT:15>), ha="<STR_LIT>",<EOL>va="<STR_LIT>", textcoords="<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if X_lda.shape[<NUM_LIT:1>] == <NUM_LIT:1>:<EOL><INDENT>plt.ylim((<NUM_LIT:0.5>, <NUM_LIT>))<EOL><DEDENT>try:<EOL><INDENT>ax.set_xlabel("<STR_LIT>".<EOL>format(exp_var[<NUM_LIT:0>]*<NUM_LIT:100>), fontsize=font_size, labelpad=label_pad)<EOL><DEDENT>except:<EOL><INDENT>ax.set_xlabel("<STR_LIT>", fontsize=font_size, labelpad=label_pad)<EOL><DEDENT>try:<EOL><INDENT>ax.set_ylabel("<STR_LIT>".<EOL>format(exp_var[<NUM_LIT:1>]*<NUM_LIT:100>), fontsize=font_size, labelpad=label_pad)<EOL><DEDENT>except:<EOL><INDENT>ax.set_ylabel("<STR_LIT>", fontsize=font_size, labelpad=label_pad)<EOL><DEDENT>leg = plt.legend(loc="<STR_LIT>", scatterpoints=<NUM_LIT:3>, frameon=True, framealpha=<NUM_LIT:1>, fontsize=<NUM_LIT:15>)<EOL>leg.get_frame().set_edgecolor('<STR_LIT:k>')<EOL>if dim == <NUM_LIT:2> and style:<EOL><INDENT>gu.ggplot2_style(ax)<EOL>fc = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>fc = "<STR_LIT:none>"<EOL><DEDENT>if out_fp:<EOL><INDENT>plt.savefig(out_fp, facecolor=fc, edgecolor="<STR_LIT:none>", dpi=<NUM_LIT>, bbox_inches="<STR_LIT>",<EOL>pad_inches=<NUM_LIT:0.1>)<EOL><DEDENT>else:<EOL><INDENT>plt.show()<EOL><DEDENT>
Plot transformed LDA data.