Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyQtGraph GLScatterPlotItem: How to make colors opaque

Tags:

pyqtgraph

In PyQtGraph, GLScatterPlotItem, I would like the points to not blend color together when the points overlap. I want to see the closest point, and not the ones behind.

I have asked for the colors to be opaque (alpha = 1.0), but when the dots in a plot overlap, the color just turns a shade of magenta, even if all the points in that region arevery similar color.

Here's an example:

plt = gl.GLScatterPlotItem(pos=coords, color = colors, size=5, pxMode=True) where colors are a sort of 'heat map' that range from red to blue.

The plot I get is this:

Terrible color rendition.  Why Magenta Everywhere?

You can see there is some red, but everywhere the points really overlap, the color goes weird.

On the other hand, if I do the simple modification of size=1, then the colors are nice, but the dots are tiny, and can be hard to see:

Much better color, but tiny points

This is exactly the same data both time. You can start to see a little of the magenta color over to the left and rear where point desity is high, but other than that, the colors are correct.

How can I prevent the magentification of my plots?

Thanks a bunch!

like image 577
caleb c. Avatar asked May 06 '16 22:05

caleb c.


1 Answers

OpenGL is probably rendering dots additively and saturating. Try:

plt.setGLOptions('opaque')

I ran into this as well; the default options are pretty for volumetric data, but aren't great for dense point clouds from surfaces. If you figure out something even better, i.e. local patches with illumination, post back about it!

like image 58
Andrew Wagner Avatar answered Oct 22 '22 17:10

Andrew Wagner