Python: How can i add a second "non-Nan"-condition to the limits of my quiver plot axis?

76 Views Asked by At

I wanna set the limits of my quiver plot axes s.t. NaNs in the outer used grid do not cause my axe limits being unnecessarily long without any data points.

What I got is by myself is:

import numpy as np
pylab.xlim(np.min(Km[np.isnan(C_diff) < 0.5 ]), np.max(Km[np.isnan(C_diff) < 0.5 ]))
    #two conditions: "np.min(Cm[np.isnan(K_diff) < 0.5" on min, max (Km) are missing 

pylab.ylim(np.min(Cm[np.isnan(K_diff) < 0.5 ]), np.max(Cm[np.isnan(K_diff) < 0.5 ])) 
    #two conditions: "np.min(Km[np.isnan(K_diff) < 0.5" on min, max (Cm) are missing

To further illustrate, in matlab language I wanna have:

xlim([min(min(Km(real(~(isnan(K_diff))).*real(~(isnan(C_diff))) > 0.5))),
max(max(Km(real(~(isnan(K_diff))).*real(~(isnan(C_diff))) > 0.5)))]);

ylim([min(min(Cm(real(~(isnan(K_diff))).*real(~(isnan(C_diff))) > 0.5))),
max(max(Cm(real(~(isnan(K_diff))).*real(~(isnan(C_diff))) > 0.5)))]);

Would be great to get an answer! Thanks in advance! :)

Tobias

1

There are 1 best solutions below

0
econstud12345 On BEST ANSWER

I guess I fixed it by:

pylab.xlim(np.min(Km[np.isnan(C_diff)^np.isnan(K_diff).all() < 0.5 ]), 
np.max(Km[np.isnan(C_diff)^np.isnan(K_diff).all() < 0.5 ]))
pylab.ylim(np.min(Cm[np.isnan(K_diff)^np.isnan(C_diff).all() < 0.5 ]),
np.max(Cm[np.isnan(K_diff)^np.isnan(C_diff).all() < 0.5 ])) 

However from the results I see no difference, but that is possible by logical operators.