Font of legend and axes label are not equal

63 views
Skip to first unread message

maxsp...@googlemail.com

unread,
Sep 23, 2016, 5:01:46 AM9/23/16
to pyqtgraph
Hello,

I have a legend. There, the greek letters (e.g. Lambda) are displayed correctly. Unfortunately not for the AxisLabel.

Here is a short example of the code.

###

import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore

pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')

win = pg.GraphicsWindow(title="TITLE")

FONT_NAME = 'Nimbus Roman No9 L'
Font = QtGui.QFont(FONT_NAME)

win.setFont(Font)


plt = win.addPlot(title="")
leg = plt.addLegend(offset=(30, 30))

plt.plot([45,32],[5,20],pen=pg.mkPen('g', width=2),name='&lambda; &lambda; <sub>&lambda;</sub> &Phi;')


LabelStyle = {'color': '#000000','background-color': '#FFFFFF','font-size': '40px','bold': False,'italic': False,'font-family': 'Nimbus Roman No9 L'}


plt.setLabel('left','LEFTAxisLabel &lambda; &lambda; <sub>&lambda;</sub> &Phi;','','', **LabelStyle)
plt.setLabel('bottom','BottomAxisLabel &lambda; &lambda; <sub>&lambda;</sub> &Phi;','','', **LabelStyle)


leg.setScale(2)
for item in leg.items:
    for single_item in item:
        #single_item.setScale(1)
        if isinstance(single_item, pg.graphicsItems.LabelItem.LabelItem):
            single_item.item.setFont(Font)
        else:
            pass


###


Thank you and best regards

Max
example.png
Reply all
Reply to author
Forward
0 new messages