在pyqtgraph中设置背景颜色的问题 [英] Issue in setting the background color in pyqtgraph

查看:598
本文介绍了在pyqtgraph中设置背景颜色的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 python 中使用 pyqtgraph 模块时遇到问题.当我将白色背景颜色添加到 glscatterplot 时,散点就会消失.就像如果背景颜色被添加到散点图的颜色中,那么一切都是白色的.这是我使用的一段代码:

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)

如果我在 setBackgroundColor 方法中将 ('w') 替换为 ('k'),则 scatter 的颜色很好,背景为黑色.有没有其他人遇到过这个问题?

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?

推荐答案

我想原因是你没有设置前景色.试试:

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')

这篇关于在pyqtgraph中设置背景颜色的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆