Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue in setting the background color in pyqtgraph

I've got an issue when using the pyqtgraph module in python. When I put a white background color 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 and the background is black. Did anyone else ever get this issue?

like image 912
ymmx Avatar asked Jul 22 '15 15:07

ymmx


1 Answers

I think the reason is that you haven't set the foreground colour. try:

import pyqtgraph as pg

pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
like image 58
Don Smythe Avatar answered Oct 12 '22 03:10

Don Smythe