What steps will reproduce the problem?
1. In visvis\examples\embeddingInQt4.py add the line
import numpy as np
and change line 60 from
vv.plot([1,2,3,1,6]) to vv.plot([0.5,2.,3.,np.nan,3.,1.,6.])
2. Run the example. Press "Push me" for the plot to appear.
3. Examine the plot
What is the expected output? What do you see instead?
The correct y range for [0.5,2.,3.,np.nan,3.,1.,6.] is [0.5, 6.], however the
plot has selected a default choice [0.,1.] .
What version of the product are you using? On what operating system?
visvis 1.7
Python 2.6
Pyside
Win7 x64
Qt 4.7.4
Please provide any additional information below.
The choice seems to be to fix Line._GetLimits to return a range that respects
NaNs, or fix Axes.SetLimits to correctly recover from range=[nan,nan].
In Line._GetLimits I made the following change, but it may not be a best
implementation for the full generality and architecture of visvis.
#x1, x2 = self._points[:,0].min(), self._points[:,0].max()
#y1, y2 = self._points[:,1].min(), self._points[:,1].max()
#z1, z2 = self._points[:,2].min(), self._points[:,2].max()
x1, x2 = np.nanmin(self._points[:,0]), np.nanmax(self._points[:,0])
y1, y2 = np.nanmin(self._points[:,1]), np.nanmax(self._points[:,1])
z1, z2 = np.nanmin(self._points[:,2]), np.nanmax(self._points[:,2])
The fix above is consistent with Mesh._GetLimits, for example, that takes the
approach of managing nans within object.
(Axes.SetLimits does test for NaN, but if found, reverts to default ranges.)
Original issue reported on code.google.com by
owe...@hotmail.comon 3 Oct 2012 at 3:39