I am having the same issue trying to fill the points in a scatterplot with 
a list of colors. I have a list of colors that I am trying to pass with 
s1.setBrush. The list has the same length as x and y and each row is a 3 
numbers.

it looks like this
[ (81,0,0),(135,0,0)....]


Is there a way to color each point of a scatterplot with a unique color


On Friday, December 9, 2016 at 4:38:00 AM UTC-7, Surabhi choudhary wrote:
>
> I am facing problem in passing list through setBrush.
>
>
> <https://lh3.googleusercontent.com/-gKziwwO4fSQ/WEqXgv9x1GI/AAAAAAAAV8k/xL9I8aRhWVgHR1CZP6pt1y2R3FnXtLnvgCLcB/s1600/1.JPG>
>
>
> On Sunday, October 19, 2014 at 7:58:01 PM UTC+5:30, Nicholas Tan Jerome 
> wrote:
>>
>> No problem, if my fix is accepted, in future you don't need this hack to 
>> make it work :)
>>
>> On Friday, 17 October 2014 17:22:41 UTC+2, Bobby Henley wrote:
>>>
>>> I don't fully understand why, but that did the trick! Thank you very much
>>>
>>> On Friday, October 17, 2014 5:09:26 AM UTC-4, Nicholas Tan Jerome wrote:
>>>>
>>>> Hi Bobby,
>>>>
>>>> I think you are right that setBrush should also accept list, not only 
>>>> that, one can use mask to determine which to be filled.
>>>>
>>>> A hack to make this work is to pass the "mask" keyword
>>>>
>>>> do it like this 
>>>>
>>>> example.setBrush(['r']*numberofscatterpoints, mask=None) and this 
>>>> should work.
>>>>
>>>> I feel like the keyword is not checked properly. If one can just check 
>>>> the mask keyword before, then we will not need to always pass mask=None to 
>>>> make this work.
>>>>
>>>> pull request: 
>>>>
>>>> https://github.com/pyqtgraph/pyqtgraph/commit/884df4934af6eadaa0065b700853838a32440576
>>>>
>>>> -N
>>>>
>>>>
>>>> On Thursday, 16 October 2014 23:41:08 UTC+2, Bobby Henley wrote:
>>>>>
>>>>> I have a scatterplot containing a large amount of points, I would like 
>>>>> to be able to change the colors of points on the fly, and change certain 
>>>>> ones to different colors.
>>>>> The documentation for setBrush indicates that it should be able to 
>>>>> take a list of values and set the brush colors accordingly. So far this 
>>>>> command only works for using a single brush value for all points on a 
>>>>> scatterplot. When I try to input a list, say for example
>>>>>
>>>>> example=pg.ScatterPlotItem()
>>>>> example.setBrush(['r']*numberofscatterpoints)
>>>>>
>>>>> will return the following error
>>>>>
>>>>>   File 
>>>>> "E:\Robert\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\pyqtgraph\graphicsItems\ScatterPlotItem.py",
>>>>>  
>>>>> line 446, in setBrush
>>>>>     if kargs['mask'] is not None:
>>>>> KeyError: 'mask'
>>>>>
>>>>> but if I try to use only one input value, ie
>>>>>
>>>>> example=pg.ScatterPlotItem()
>>>>> example.setBrush('r')
>>>>>
>>>>> I have no issues. Does setBrush not actually take lists? Or am I doing 
>>>>> something wrong?
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/1eba5d9a-e4a9-4305-8d6d-ce9999008fb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to