Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What other methods to define metadata colors are allowed, besides color labels ('black', 'pink', etc)? #91

Closed
perseeker opened this issue Feb 28, 2024 · 1 comment

Comments

@perseeker
Copy link

perseeker commented Feb 28, 2024

I'd like to not specify colors by hand, and instead use pre-made colormaps, like from maplotlib.cm. I tried to form a list of colors first, by using
list([plt.cm.tab20b(j) for j in range(20)]) - this produces a list of 20 colors in format (x, y, z, 1)
I then used this list to define colors for metadata categories in my pyWGCNA object, but ran into a problem - colors in this format are interpreted as an iterable instead of a single entry. In particular, when running analyseWGCNA(), function plotModuleEigenGene tries to broadcast the color as an object of length of 4 instead of 1 (line: color = np.where(color == n, self.metadataColors[m][n], color))
So I ask - is there a way to specify colors without using pre-set labels?

@nargesr
Copy link
Member

nargesr commented Feb 28, 2024

Hi,

I believe you can use hex color codes as well. Basically, any single value parameter should be fine.
I'm pretty sure you can convert this format to hex code through Matplotlib but please let me know if you still have the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants