Minor fix in ScatterPlotItem handling of per-point data

This commit is contained in:
Luke Campagnola 2013-11-10 23:25:07 -05:00
parent ccc5e6274a
commit 810b90a1e6
2 changed files with 6 additions and 1 deletions

View File

@ -404,19 +404,24 @@ class AxisItem(GraphicsWidget):
return self.mapRectFromParent(self.geometry()) | linkedView.mapRectToItem(self, linkedView.boundingRect())
def paint(self, p, opt, widget):
prof = debug.Profiler('AxisItem.paint', disabled=True)
if self.picture is None:
try:
picture = QtGui.QPicture()
painter = QtGui.QPainter(picture)
specs = self.generateDrawSpecs(painter)
prof.mark('generate specs')
if specs is not None:
self.drawPicture(painter, *specs)
prof.mark('draw picture')
finally:
painter.end()
self.picture = picture
#p.setRenderHint(p.Antialiasing, False) ## Sometimes we get a segfault here ???
#p.setRenderHint(p.TextAntialiasing, True)
self.picture.play(p)
prof.finish()
def setTicks(self, ticks):

View File

@ -517,7 +517,7 @@ class ScatterPlotItem(GraphicsObject):
## Bug: If data is a numpy record array, then items from that array must be copied to dataSet one at a time.
## (otherwise they are converted to tuples and thus lose their field names.
if isinstance(data, np.ndarray) and len(data.dtype.fields) > 1:
if isinstance(data, np.ndarray) and (data.dtype.fields is not None)and len(data.dtype.fields) > 1:
for i, rec in enumerate(data):
dataSet['data'][i] = rec
else: