Improve ScatterPlotItem
Slightly faster and more memory efficient, correct python 3 bug
This commit is contained in:
parent
26b84693a8
commit
f5ee45ac28
@ -4,6 +4,10 @@ import pyqtgraph.functions as fn
|
|||||||
from .GraphicsItem import GraphicsItem
|
from .GraphicsItem import GraphicsItem
|
||||||
from .GraphicsObject import GraphicsObject
|
from .GraphicsObject import GraphicsObject
|
||||||
from itertools import starmap
|
from itertools import starmap
|
||||||
|
try:
|
||||||
|
from itertools import imap
|
||||||
|
except ImportError:
|
||||||
|
imap = map
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import scipy.stats
|
import scipy.stats
|
||||||
import weakref
|
import weakref
|
||||||
@ -702,8 +706,8 @@ class ScatterPlotItem(GraphicsObject):
|
|||||||
# rect = QtCore.QRectF(y, x, h, w)
|
# rect = QtCore.QRectF(y, x, h, w)
|
||||||
# self.fragments.append(QtGui.QPainter.PixmapFragment.create(pos, rect))
|
# self.fragments.append(QtGui.QPainter.PixmapFragment.create(pos, rect))
|
||||||
rect = starmap(QtCore.QRectF, self.data['fragCoords'])
|
rect = starmap(QtCore.QRectF, self.data['fragCoords'])
|
||||||
pos = map(QtCore.QPointF, pts[0,:], pts[1,:])
|
pos = imap(QtCore.QPointF, pts[0,:], pts[1,:])
|
||||||
self.fragments = map(QtGui.QPainter.PixmapFragment.create, pos, rect)
|
self.fragments = list(imap(QtGui.QPainter.PixmapFragment.create, pos, rect))
|
||||||
|
|
||||||
def setExportMode(self, *args, **kwds):
|
def setExportMode(self, *args, **kwds):
|
||||||
GraphicsObject.setExportMode(self, *args, **kwds)
|
GraphicsObject.setExportMode(self, *args, **kwds)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user