Search code examples
colorsbackgroundtransparentpyqtgraph

How to make transparent background in Pyqtgraph?


I'm currently creating graphs using pyqtgraph, however I'm stuck with the background color since I would like it to be transparent or basically to have no background at all. I've read the docs but so far I haven't been able to achieve this. I'm currently using the following method to have a white background, but the parameter 'None' is not accepted:

import pyqtgraph as pg

pg.setConfigOption('background', (255,255,255))

I would appreciate any help.


Solution

  • The alpha channel controls transparency. Try something like

    pg.setConfigOption('background', (255,255,255, 100))
    

    Adjust the last value as desired. Alpha value of zero results in a fully transparent color; value of 255 results in a fully opaque color.

    See docs here.