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

Advice on dealing with nan values for colormaps #4

Open
aparente-nurix opened this issue Dec 12, 2019 · 1 comment
Open

Advice on dealing with nan values for colormaps #4

aparente-nurix opened this issue Dec 12, 2019 · 1 comment

Comments

@aparente-nurix
Copy link

I may want to post this issue in the faerun-python github but posting here for now since its relevant to tmap.

I'm creating tmaps for chemical libraries and coloring each structure by various numerical (non-categorical) properties (eg. cLogP). How would you suggest dealing with missing data points (eg. only having some cLogP measurements for some samples)? I tried using np.nan to fill the missing values but the html files come out blank, black background & menu appear but no tree or legend.

It also generates a Runtime Exception when calculating the diff variable in faerun.py because the max/min values yield nan.

RuntimeWarning: invalid value encountered in double_scalars

A couple things I tried in editing faerun.py: Changing the the way diff is calculated to use np.nanmin and np.nanmax removes the runtime warning but still doesn't create the plot correctly. Similarly, trying to set the color for NaN values using cmap.set_bad(color='gray') doesn't work either.

@slochower
Copy link

slochower commented Mar 13, 2020

I'm running into this issue as well. As a temporary workaround, I'm casting the value for NaN data points out of range (for example, setting the value to -1 for a property that's strictly positive), but I agree that there should be a better way to deal with this.

CC @daenuprobst

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