How to change the text style of axis labels and titles

57 views
Skip to first unread message

JJ

unread,
Aug 5, 2021, 8:55:26 AM8/5/21
to pyqtgraph
Is there any workaround to support this? I can set the tick font as follows:

plot_item = plotwidget1.getPlotItem()
axis = plot_item.getAxis('bottom')
font = QFont("Roboto")
axis.setTickFont(font) 


However, there is no function to support the font style of the actual axis label.
plot_item.setLabel('bottom', 'time') #how to change the font?




Patrick

unread,
Aug 5, 2021, 10:43:22 PM8/5/21
to pyqtgraph
Hi,

I think Google Groups lost my reply to this... apologies if double posting. Try getting the label property of the axis and using setFont() on that.

#...
font = self.plot.getAxis("left").label.font()
font.setFamily("Serif")
self.plot.getAxis("left").label.setFont(font)
self.plot.getAxis("left").setTickFont(font)
#...

Patrick
Reply all
Reply to author
Forward
0 new messages