Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Pyqtgraph scatter white backgroundcolor issue #193

Open
ymmx opened this issue Jul 22, 2015 · 2 comments
Open

Python Pyqtgraph scatter white backgroundcolor issue #193

ymmx opened this issue Jul 22, 2015 · 2 comments
Labels

Comments

@ymmx
Copy link

ymmx commented Jul 22, 2015

I've got an issue when using the pyqtgraph module in python. When I put a white backgrouncolor to a glscatterplot, the scatter dots just vanish. It is like if the color of background was added to the color of the scatterplot therefore everything is white. Here is a piece of the code I use:

w = gl.GLViewWidget()
w.setBackgroundColor('w')
w.show()
sp3 = gl.GLScatterPlotItem(pos=np.transpose(pos3), color=rgba_img, size=1, pxMode=False)
w.addItem(sp3)

If I replace ('w') by ('k') in the setBackgroundColor method the color of scatter is fine, with a black background. did anybody ever get this issue and found a solution to it?

@ixjlyons
Copy link
Member

There is an option for GLScatterPlotItem called glOptions. By default, 'additive' is used (see pyqtgraph.opengl.GLGraphicsItem.GLOptions), so depth testing is disabled. You can change it to 'translucent' like so:

scatterPlotItem.setGLOptions('translucent')

I tested this in the 3D graphics scatter plot example with a white background, and it worked fine. Clouds of points don't look as good as they do with the 'additive' option and a black background, however.

It's more of a workaround than a fix, but I'm not sure what the correct solution is. Perhaps 'additive' could remain as the default, but there should probably be some mention of this in the docs -- maybe in the setBackgroundColor() docstring.

edit: Also, note that there is a bug in GLViewWidget which incorrectly sets the background color (see #194), so only "pure" colors like black, white, red, green, etc. will work.

@ymmx
Copy link
Author

ymmx commented Jul 23, 2015

Great, that's work well. This is tricky to find so ;)
Thank you alot

@j9ac9k j9ac9k added the docs label Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants