如何在 PyQt5 中设置 PlotWidget 刻度颜色?

How to set the PlotWidget Tick Color in PyQt5?

我正在尝试将样式设置为 pyqtgraph.PlotWidget 绘图区域的轴。我正在使用:

font = QFont()
font.setPointSize(14)
font.setBold(True)
font.setWeight(75)

myPlotWidget.getAxis('left').setPen('b')
myPlotWidget.getAxis('left').setFont(font)

而且我不明白为什么刻度标签颜色不是蓝色,而轴、网格和轴标签是蓝色。

您需要明确使用 AxisItem.setTextPen()

self.graphWidget.getAxis('left').setTextPen('b')