pyqtgraph/examples/test_scatterPlot.py
Luke Campagnola 7629bca34d Updates merged in from ACQ4:
- converted most old-style signals into new-style for PySide compatibility (beware: API changes)
  - removed ObjectWorkaround, now just using QGraphicsWidget
  - performance enhancements, particularly in ROI.getArrayRegion
  - numerous bugfixes
2011-04-05 10:35:50 -04:00

27 lines
716 B
Python

# -*- coding: utf-8 -*-
import sys, os
## Add path to library (just for examples; you do not need this)
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
from PyQt4 import QtGui, QtCore
import pyqtgraph as pg
import numpy as np
app = QtGui.QApplication([])
mw = QtGui.QMainWindow()
cw = pg.PlotWidget()
mw.setCentralWidget(cw)
mw.show()
s1 = pg.ScatterPlotItem(size=10, pen=QtGui.QPen(QtCore.Qt.NoPen), brush=QtGui.QBrush(QtGui.QColor(255, 255, 255, 20)))
pos = np.random.normal(size=(2,3000))
spots = [{'pos': pos[:,i]} for i in range(3000)]
s1.addPoints(spots)
cw.addDataItem(s1)
## Start Qt event loop unless running in interactive mode.
if sys.flags.interactive != 1:
app.exec_()