How to change background color of legend?

312 views
Skip to first unread message

Mitul Vekariya

unread,
Jul 25, 2014, 12:55:07 PM7/25/14
to pyqt...@googlegroups.com
Hey guys

First of all, thank you for offering such great tool.

Here's the problem: I am using pyqtgraph with white background. When I added legend to my graph, it has opaque black color. I tried a lot to find how to change the color property of legend, but all in vain. Is it possible to change the background of legend to white? 

Thanks
Mitul Vekariya
Message has been deleted

Yusuke Yoshihara

unread,
Oct 11, 2016, 9:52:15 AM10/11/16
to pyqtgraph
You might have already solved the problem... but i tried it.

The simplest way that i think is to edit the line 122 and 123 of "C:\Python27\Lib\site-packages\pyqtgraph\graphicsItems\LegendItem.py" (in the case of windows) or, something equivalent to it
as shown in the following code,
p.setPen(fn.mkPen(0, 0, 0, 255)) #  original -> p.setPen(fn.mkPen(255,255,255,100))
p
.setBrush(fn.mkBrush(255, 255, 255, 255)) # original -> p.setBrush(fn.mkBrush(100,100,100,50))
, and the saving it. Then the background color of your legendItem should changes(and the frame clor should be black).

2014年7月26日土曜日 1時55分07秒 UTC+9 Mitul Vekariya:
Reply all
Reply to author
Forward
0 new messages