I am trying to pass list argument through setBrush.
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
import numpy as np
app = QtGui.QApplication([])
mw = QtGui.QMainWindow()
mw.resize(800,800)
view = pg.GraphicsLayoutWidget()
mw.setCentralWidget(view)
mw.setWindowTitle('pyqtgraph example: ScatterPlot')
w1 = view.addPlot()
x = [1,2,3,4,5,6,7,8,9,10]
y = [10,8,6,4,2,20,18,16,14,12]
s1 = pg.ScatterPlotItem(x,y,size=10, pen=pg.mkPen(None), brush=pg.mkBrush(255, 255, 255, 120))
s1.setBrush(['r']*10, mask=None)
w1.addItem(s1)
mw.show()
When I run this code, I am getting error as follows:
Traceback (most recent call last): File "", line 1, in
File "C:\Python34\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 467, in setBrush self.updateSpots(dataSet)
File "C:\Python34\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 553, in updateSpots self.fragmentAtlas.getAtlas() # generate atlas so source widths are available.
File "C:\Python34\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 193, in getAtlas self.buildAtlas()
File "C:\Python34\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 143, in buildAtlas img = renderSymbol(key[0], key[1], sourceRect.pen, sourceRect.brush)
File "C:\Python34\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 74, in renderSymbol drawSymbol(p, symbol, size, pen, brush)
File "C:\Python34\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py", line 49, in drawSymbol painter.setBrush(brush) TypeError: arguments did not match any overloaded call: QPainter.setBrush(QBrush): argument 1 has unexpected type 'str' QPainter.setBrush(Qt.BrushStyle): argument 1 has unexpected type 'str'
How can I pass list though setBrush? I have to assign different color to different points.


