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

"Warning: converting a masked element to nan." No points shown. #24

Closed
MikeDacre opened this issue Apr 1, 2017 · 2 comments
Closed

Comments

@MikeDacre
Copy link

I am trying to use this on a plot that looks like this right now:

image

I am then trying to alter it with adjust_text(text), where text is:

[<matplotlib.text.Text at 0x7f6fde11d0f0>,
 <matplotlib.text.Text at 0x7f6fde11d6a0>,
 <matplotlib.text.Text at 0x7f6fde3fa4a8>,
 <matplotlib.text.Text at 0x7f6fde3f77b8>,
 <matplotlib.text.Text at 0x7f6fde3fd0f0>,
 <matplotlib.text.Text at 0x7f6fe04b4940>,
 <matplotlib.text.Text at 0x7f6fdfd3cd68>,
 <matplotlib.text.Text at 0x7f6fdfd9e208>,
 <matplotlib.text.Text at 0x7f6fde421ef0>,
 <matplotlib.text.Text at 0x7f6fde421198>,
 <matplotlib.text.Text at 0x7f6fdfe63f60>,
 <matplotlib.text.Text at 0x7f6fde0c7f98>]

Which is made up of:

4.99589203359e-05 0.136983144207 negative regulation of NF-kappaB transcription factor activity
1.42708419659e-07 0.00037604688739 regulation of I-kappaB kinase/NF-kappaB cascade
0.000122124137553 0.21743354123 LCP2 subnetwork
4.50311931626e-05 0.0790067851443 positive regulation of NF-kappaB import into nucleus
2.47281533515e-07 0.00039942634259 positive regulation of I-kappaB kinase/NF-kappaB cascade
9.8434675214e-07 0.00144148348153 B cell derived lymphoma
0.0036200813333 4.64673586023e-11 induction of apoptosis
0.00375139560284 6.10942616437e-11 induction of programmed cell death
7.12426700332e-05 4.99145223337e-12 myeloid leukocyte differentiation
0.00328031836042 3.21793224938e-09 dermatitis
0.00259303191503 4.66745286746e-09 decreased susceptibility to parasitic infection
0.181946564329 2.29179363976e-06 MCL1 subnetwork

When I try to do that though, I end up with the following error:

/usr/local/anaconda3/lib/python3.5/site-packages/numpy/ma/core.py:4185: UserWarning: Warning: converting a masked element to nan.
  warnings.warn("Warning: converting a masked element to nan.")

And no points are shown at all.

Any idea why this is happening? I am scratching my head.

Using python 3.5.2 with anaconda. Installed adjustText with pip today.

@MikeDacre
Copy link
Author

By moving the adjust_text function up to the top and running it before any other plot modifications, I was able to eliminate this bug.

Thanks for an amazing piece of code.

@MikeDacre MikeDacre reopened this Apr 1, 2017
@MikeDacre
Copy link
Author

MikeDacre commented Apr 1, 2017

Actually, I figured out the problem:

This happens when inverting the axes prior to plotting.

It works fine if I don't invert the axes.

image

I can also avoid the above error by just inverting the axes after everything else is done, but the problem with that is that then the points are no longer nicely aligned:

image

As the error is no longer happening, I am going to close this now and open another issue to ask about the above specifically.

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

1 participant