@@ -185,15 +185,16 @@ class QwtPointArrayData(QwtSeriesData):
185185 """
186186 Interface for iterating over two array objects
187187
188- .. py:class:: QwtCQwtPointArrayDataolorMap (x, y, [size=None])
188+ .. py:class:: QwtPointArrayData (x, y, [size=None], [finite=True ])
189189
190190 :param x: Array of x values
191191 :type x: list or tuple or numpy.array
192192 :param y: Array of y values
193193 :type y: list or tuple or numpy.array
194194 :param int size: Size of the x and y arrays
195+ :param bool finite: if True, keep only finite array elements (remove all infinity and not a number values), otherwise do not filter array elements
195196 """
196- def __init__ (self , x = None , y = None , size = None ):
197+ def __init__ (self , x = None , y = None , size = None , finite = None ):
197198 QwtSeriesData .__init__ (self )
198199 if x is None and y is not None :
199200 x = np .arange (len (y ))
@@ -210,8 +211,13 @@ def __init__(self, x=None, y=None, size=None):
210211 if size is not None :
211212 x = np .resize (x , (size , ))
212213 y = np .resize (y , (size , ))
213- self .__x = x
214- self .__y = y
214+ if finite if finite is not None else True :
215+ indexes = np .logical_and (np .isfinite (x ), np .isfinite (y ))
216+ self .__x = x [indexes ]
217+ self .__y = y [indexes ]
218+ else :
219+ self .__x = x
220+ self .__y = y
215221
216222 def boundingRect (self ):
217223 """
@@ -343,4 +349,4 @@ def swapData(self, series):
343349 """
344350 swappedSeries = self .__series
345351 self .__series = series
346- return swappedSeries
352+ return swappedSeries
0 commit comments