reneshbedre / bioinfokit

Bioinformatics data analysis and visualization toolkit
MIT License
340 stars 76 forks source link

Possible typos - color_result in visuz.py #26

Closed GanshengT closed 3 years ago

GanshengT commented 3 years ago

When I run the function biplot(), I got an error message: " name 'color_result' is not defined". After looking through visuz.py. I found the following codes (line 1594-1605):

if colordot and isinstance(colordot, (tuple, list)):
                        colour_map = ListedColormap(colordot)
                        # for i in range(len(list(unique_class))):
                        #    color_dict[list(unique_class)[i]] = colordot[i]
                        # color_result = [color_dict[i] for i in colorlist]
                        s = plt.scatter(cscore[:, 0] * xscale, cscore[:, 1] * yscale, c=color_result_num, cmap=colour_map,
                                        s=dotsize, alpha=valphadot, marker=markerdot)
                        plt.legend(handles=s.legend_elements()[0], labels=list(unique_class), loc=legendpos)
                    elif colordot and not isinstance(colordot, (tuple, list)):
                        # s = plt.scatter(cscore[:, 0] * xscale, cscore[:, 1] * yscale, color=color_result, s=dotsize,
                        #                alpha=valphadot, marker=markerdot)
                        # plt.legend(handles=s.legend_elements()[0], labels=list(unique_class))
                        s = plt.scatter(cscore[:, 0] * xscale, cscore[:, 1] * yscale, c=color_result, s=dotsize,
                                    alpha=valphadot, marker=markerdot)
                        plt.legend(handles=s.legend_elements()[0], labels=list(unique_class), loc=legendpos)

As far as I am concerned, the " s = plt.scatter(cscore[:, 0] xscale, cscore[:, 1] yscale, c=color_result, s=dotsize, alpha=valphadot, marker=markerdot)" should be : s = plt.scatter(cscore[:, 0] xscale, cscore[:, 1] yscale, c=color_result_num, s=dotsize, alpha=valphadot, marker=markerdot)

What are your thoughts?

reneshbedre commented 3 years ago

@GanshengT

Thank you for your thoughts. I think you are looking at the old version of the codes. Please install or upgrade to the latest version of bioinfokit (v2.0.2). It should solve this issue. Let me know if it does not work after upgrading to the latest version. Thank you.

GanshengT commented 3 years ago

Yes. This has been solved in v2.0.2. I am closing this issue.